본문 바로가기

기타

Having a problem with Flutter Doctor on Arch Linux

반응형

Having a problem with Flutter Doctor on Arch Linux

I am running Arch Linux.

I have a problem where flutter doctor doesn't recognize my Android Sdk.

My Flutter Doctor output:

[✓] Flutter (Channel stable, 2.10.3, on Arch Linux 5.16.15-arch1-1, locale en_US.UTF-8)
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2021.1)
[✓] Android Studio
[!] Connected device
    ! No devices available
[✓] HTTP Host Availability

! Doctor found issues in 3 categories.

Here is a more detailed summary:

[✓] Flutter (Channel stable, 2.10.3, on Arch Linux 5.16.15-arch1-1, locale en_US.UTF-8)
    • Flutter version 2.10.3 at /home/tt/Downloads/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7e9793dee1 (3 weeks ago), 2022-03-02 11:23:12 -0600
    • Engine revision bd539267b4
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 2021.1)
    • Android Studio at /home/tt/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8193401
    • Flutter plugin version 65.2.2
    • Dart plugin version 211.7808
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] Android Studio
    • Android Studio at /opt/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[!] Connected device
    ! No devices available

[✓] HTTP Host Availability
    • All required HTTP hosts are available

As you can see, it doesn't recognize my Android Sdk. I tried this:

flutter config --android-sdk /home/tt/Android/Sdk/platforms/android-32/android.jar

and I got:

Setting "android-sdk" value to "/home/tt/Android/Sdk/platforms/android-32/android.jar".

You may need to restart any open editors for them to read new settings.

I ran flutter doctor but didn't work. I restarted my machine and it still doesn't work.

I already had Android Studio from the Toolbox Application. I tried installing it from the .tar.gz version. Still doesn't work. I installed from the AUR, but nothing works.

Can you please help..




You can do this inside of a markdown cell. A markdown cell can be created by selecting a cell then pressing the esc key followed by the M key. You can tell when you have converted a cell to markdown when In [ ]: seen to the right of the default code cell is gone. Then you can input the following code that uses latex with markdown to represent sub/super-scripts:

Latex subscript:

$x_{2}$

Latex superscript:

$x^{2}$

You can find more detailed examples here.

Please comment below if you are still having difficulty.




You can use HTML ' superscript '

http://wikimarkup.wikia.com/wiki/How_to_superscript_text

You can also use Latex $foo^{superscript}$, but the font used to render the text will change and you might not like how it looks.




<sup>superscript text </sup> also works, and might be better because latex formatting changes the whole line etc.




What a meta question! One needs to use Markdown to answer Markdown syntax questions. Markdown does have the <sup></sup> and <sub></sub> tags that will adjust text to super- or sub- script, respectively in the typeface of the current block. If you are using the scripts for mathematical statements like this the LaTeX transformation makes sense. If you are using the scripts for footnotes or perhaps for something like chemical formulas (e.g. H2O) it might be preferable to use the first method rather than LaTeX. Mixing fonts is generally not considered a good graphics/typography practice!




Let's say, you want to write this:
enter image description here

Then, here is what you need to write in your Markdown:

\hat{Y} = a + b_1 X_1 + b_2 X_2 + b_3 X_1 X_2 + b_4 X_1^2 + b_5 X_2^2



Try using pd.DataFrame.style.format for this:

df = pd.DataFrame(['http://google.com', 'http://duckduckgo.com'])

def make_clickable(val):
    return '<a href="{}">{}</a>'.format(val,val)

df.style.format(make_clickable)

I hope this proves useful.




If you want to apply URL formatting only to a single column, you can use:

data = [dict(name='Google', url='http://www.google.com'),
        dict(name='Stackoverflow', url='http://stackoverflow.com')]
df = pd.DataFrame(data)

def make_clickable(val):
    # target _blank to open new window
    return '<a target="_blank" href="{}">{}</a>'.format(val, val)

df.style.format({'url': make_clickable})

(PS: Unfortunately, I didn't have enough reputation to post this as a comment to @Abdou's post)




@shantanuo : not enough reputation to comment. How about the following?

def make_clickable(url, name):
    return '<a href="{}" rel="noopener noreferrer" target="_blank">{}</a>'.format(url,name)

df['name'] = df.apply(lambda x: make_clickable(x['url'], x['name']), axis=1)




from IPython.core.display import display, HTML
import pandas as pd

# create a table with a url column
df = pd.DataFrame({"url": ["http://google.com", "http://duckduckgo.com"]})

# create the column clickable_url based on the url column
df["clickable_url"] = df.apply(lambda row: "<a href='{}' target='_blank'>{}</a>".format(row.url, row.url.split("/")[2]), axis=1)

# display the table as HTML. Note, only the clickable_url is being selected here
display(HTML(df[["clickable_url"]].to_html(escape=False)))



I found this at How to Create a Clickable Link(s) in Pandas DataFrame and JupyterLab which solved my problem:

HTML(df.to_html(render_links=True, escape=False))



enter image description here

Obviously, this is not a universal problem.

You can read the docs and recreate the conda environment.

This may also be related to the fact that your conda environment is not activated. Use the command conda activate ct to activate it.




Switching to the "pre-release" version of the Jupyter extension immediately solved this problem for me.




What finally worked out for me was closing VS Code entirely, recreating the environment and creating a new blank notebook in VS Code. Now the kernel shows up and is surprisingly available for all new and old notebooks.

I also found this option in the Jupyter settings in VS Code: https://i.stack.imgur.com/rcJU6.png

I haven't tried it yet, but it might be helpful to someone experiencing similar issues.

Also Zac's solution above might be super helpful. Thank you for sharing!




You can use {@html expression}

Svelte does not sanitize expressions before injecting HTML. If the data comes from an untrusted source, you must sanitize it, or you are exposing your users to an XSS vulnerability.




Ordinarily, strings are inserted as plain text, meaning that characters like < and > have no special meaning.

But sometimes you need to render HTML directly into a component. For example, the words you're reading right now exist in a markdown file that gets included on this page as a blob of HTML.

In Svelte, you do this with the special {@html ...} tag:

{@html string}

Svelte doesn't perform any sanitization of the expression inside {@html ...} before it gets inserted into the DOM. In other words, if you use this feature it's critical that you manually escape HTML that comes from sources you don't trust, otherwise you risk exposing your users to XSS attacks.

From https://svelte.dev/tutorial/html-tags




You can use get:

Generally, you should read the value of a store by subscribing to it and using the value as it changes over time. Occasionally, you may need to retrieve the value of a store to which you're not subscribed. get allows you to do so.

For example:

import { readable, get } from 'svelte/store';

console.log("TEST FROM STORE: " + get(myStuff).TEST);



The way stores work in Svelte is that they wrap your value in a class which doesn't have a direct way to get the stored value. You would need to subscribe to it to get it. There's also a get method which does the same under the hood.

So in your code this would print the value. It will also print the new values as it changes.

const unsub=mystuff.subscribe(val=> console.log("CURRENT VALUE OF TEST FROM STORE: " + val.TEST))
unsub()

//this does the same thing:
import { get } from 'svelte/store';
console.log("TEST FROM STORE: " + get(myStuff).TEST);

In the .svelte files the $____ notation does this subscription for you to make it more convenient to use it.




  1. origin svelte docs about readable store
  2. when you create readable store, this store return { subscriber }
  3. $store.field - use only in svelte component
  4. if you want to log your values:
import { readable, get } from 'svelte/store';
// to get fields in your store
console.log("keys in your store" + Object.keys(myStuff));
// to get value
console.log("get value from your store" + get(myStuff).TEST);



You cannot create elements like this. Svelte compiles the code, any Svelte syntax you try to use at runtime will be meaningless.

If you create elements at runtime you need to use something like addEventListener. But you are probably doing something wrong because you generally do not have to do any of that.

If anything, you would create a separate component and instantiate it using the client-side API.




First off, you hardly (and I mean hardly), ever need to create elements manually in svelte, there is almost always a better solution. However, if you truly do need to you should just simply use the normal DOM methods such as addEventListener. Svelte doesn't monkey patch the DOM APIs or anything like that, so if you are using the DOM APIs then you should just go full vanilla JS

Event Tutorial

Example fix:

function refresh() {
        let new_text = document.getElementById('new-text');
        
        const p = document.createElement('p');
        p.addEventListener("mouseOver", handleMouseOver);
        p.addEventListener("mouseOut", handleMouseOut);
        p.innerText = "new text";

        new_text.replaceChildren(p);
}

REPL

As I said though there is a far better solution without hijacking the DOM,

<script>
    let image_holder_id     
    let colour = 'red';
    let newTextShown = false;
    
    function refresh() {
        newTextShown = true;
    }
    
    function handleMouseOver(e) {
        colour = 'green';
    }
    function handleMouseOut(e) {
        colour = 'red';
    }
</script>

<svg height="100" width="100">
  <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill={colour}>
</svg>

<div><p on:mouseover={handleMouseOver} on:mouseout={handleMouseOut}>old text</p></div>

<button on:click={refresh}>Click</button>

<div id="new-text">
    {#if newTextShown}
        <p on:mouseover={handleMouseOver} on:mouseout={handleMouseOut}>new text</p>
    {/if}
</div>

REPL




You need to call .set on your board store to update the store. The reason why your current code doesn't work is that it's retrieving the data with get, board_data no longer becomes reactive and rather it is just a regular JSON object

Child text

<script context="module">
    import { get } from 'svelte/store';
    import { board } from './data_store';
    
    export function update_sum() {
        let board_data = get(board);
        board_data.sum = 12;
        board.set(board_data) // to update the store
        return board_data.sum;
    }
</script>

REPL




Replace const assert = require('node:assert') with import assert from 'node:assert'




The following import should resolve the issue:

import { https } from "firebase-functions/v1";
import { defineString } from "firebase-functions/params"; // no /lib

const welcomeMessage = defineString("WELCOME_MESSAGE");

export const hello = https.onRequest((request, response) => {
  response.send("Message: " + welcomeMessage);
});

Dependencies:

"firebase-admin": "^11.2.0",
"firebase-functions": "^4.0.1"

And given that the error is an eslint one and it doesn't make sense in that context, adding the following to .eslintrc.js turns the blocking error into a more persmissive warning:

module.exports = {
    ...
    rules: {
        ...
        "import/no-unresolved": "warn",
    },
};



I reverted to @types/redux@3.6.31 and that resolved the problem. This version includes the index.d.ts file for redux. There might be a problem with the TypeScript compiler not looking for the index.d.ts file in the normal node_modules/redux directory, but only under node_module/@types.




I experienced the same problem on a react-native project. This fix worked for me:

You have to add "moduleResolution": "node" to the compiler options in order to include type definitions linked in package.json files.

Documentation here https://www.typescriptlang.org/docs/handbook/module-resolution.html




I already had moduleResolution: 'node' and @types/redux was deleted. But when I deleted node_modules and reinstalled, the problem went away. :shrug.




If you encounter the same issue with the following react version "^16.8.6" verify if the npm redux package

Package.json

"dependencies": {
    "@types/jest": "24.0.13",
    "@types/node": "12.0.3",
    "@types/react": "16.8.19",
    "@types/react-dom": "16.8.4",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-redux": "^7.0.3",
    "react-scripts": "3.0.1",
    "redux": "^4.0.1",
    "typesafe-actions": "^4.4.0",
    "typescript": "3.5.1"
  },

if not installed just do npm install redux no need for npm i @types/reduxas Redux package provides its own type definitions, so you don't need @types/redux installed!




Faced the same problem.

Fixed with re-installing redux and save it.

npm install redux --save




I had the same problem after installing the redux toolkit. Interestingly, I did not have to re-install node modules. What worked for me is stopping and re-starting the live server -- problem gone!

  1. on mac, on your VScode terminal, press "Control + C" to terminate the server
  2. Run "npm start" again



It means that snap.data() can be null (it is of type Map<String, dynamic>?) while doesn't support null (its parameter is of type Map<String, dynamic>).

You have 3 solutions:

1. You know that snap.data() is not null

Then you can use the ! operator:

final result = await snapshot.then((snap) => Articles.fromJson(snap.data()!));

2. Articles.fromJson actually supports null

Then you can change the parameter type of Articles.fromJson from Map<String, dynamic>? to Map<String, dynamic>.

3. Articles.fromJson doesn't support null and snap.data() can be null

Then you have to support null yourself in your code:

final result = await snapshot.then((snap) => snap.data() == null ? null : Articles.fromJson(snap.data()!));

You can read more here.




Let me save you time, you can use Flutter Chat Bubble, Get it here on pub

The library got you covered for text wrap and the rest

Below is a sample

enter image description here




Try below answer hope its help to you I have try your code and I think your problem is solved, Just Wrap your Container inside Flexible or Expanded Widget

  Expanded(
        child: Container(
          margin: EdgeInsets.symmetric(vertical: 4, horizontal: 14),
          padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
          decoration: BoxDecoration(
            color: Colors.red,
            borderRadius: BorderRadius.only(
              topLeft: Radius.circular(0),
              bottomLeft: Radius.circular(10),
              bottomRight: Radius.circular(20),
              topRight: Radius.circular(20),
            ),
          ),
          child: Text(
              "hfduasudfufabsydsxfssahfduasudfufabsydsxfssahfduasudfufabsydsxfssahfduasudfufabsydsxfssahfduasudfufabsydsxfssa"),
        ),
      ),

Result of your Screen -> enter image description here




Well you need to specify the min width to the container and you are all set. Test this:

return Row(
        mainAxisAlignment:
            isMine ? MainAxisAlignment.end : MainAxisAlignment.start,
        children: [
          IntrinsicWidth(
              child: Container(
            constraints: BoxConstraints(
                maxWidth: MediaQuery.of(context).size.width / 1.3),
            margin: EdgeInsets.symmetric(vertical: 4, horizontal: 14),
            padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
            decoration: BoxDecoration(
              color: isMine ? Colors.blue : Colors.red,
              borderRadius: BorderRadius.only(
                topLeft: isMine ? Radius.circular(20) : Radius.circular(0),
                bottomLeft: isMine ? Radius.circular(20) : Radius.circular(10),
                bottomRight: isMine ? Radius.circular(10) : Radius.circular(20),
                topRight: isMine ? Radius.circular(0) : Radius.circular(20),
              ),
            ),
            child: Text(
              message,
              style: TextStyle(
                  color: Colors.white,
                  fontWeight: FontWeight.w500,
                  fontSize: 16),
            ),
          )),
        ]);



Row(
      mainAxisAlignment:
          sendByMe ? MainAxisAlignment.end : MainAxisAlignment.start,
      children: [
        Container(
          margin: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
          decoration: BoxDecoration(
            borderRadius: BorderRadius.only(
              topLeft: Radius.circular(24),
              bottomLeft: sendByMe ? Radius.circular(0) : Radius.circular(24),
              topRight: Radius.circular(24),
              bottomRight: sendByMe ? Radius.circular(24) : Radius.circular(0),
            ),
            color: sendByMe ? Colors.blue : Colors.grey,
          ),
          padding: EdgeInsets.all(18),
          child: Container(
              constraints: BoxConstraints(
                maxWidth: 60.w,
              ),
              child: Text(
                message,
              )),
        )
      ],
    );

enter image description here




It may not be the best solution, but you can switch label and icon values.

label: Icon(Icons.close),
icon: Text('Close'),



wrap the

ElevatedButton.icon

with

Directionality

and make direction rtl




Try to set ANDROID_HOME in your environment variable.

On ~/.bashrc of you are using bash or ~/.zshrc if you are using zsh in the last line put

export ANDROID_HOME=[SDK-PATH]
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools



I believe the problem is in the PATH of Android SDK Command-Line Tools and Android SDK Build Tools.

Put the following lines at the end of the ~/.bachrc file:

export ANDROID_HOME="/home/XXX/Android/Sdk/"
export PATH="$PATH:${ANDROID_HOME}cmdline-tools/latest/bin/:${ANDROID_HOME}build-tools/33.0.0/:${ANDROID_HOME}platform-tools/"

Note that XXX, latest, and 33.0.0 must be changed according to your installation.

반응형