Code Monkey home page Code Monkey logo

Comments (9)

shifujun avatar shifujun commented on May 16, 2024 5

你看看我上面贴的那图,我都echo $ANDROID_HOME, 都显示路径了,我老早就设置了,不是一天两天了

那大概是一个环境变量生效范围的问题。你执行echo $ANDROID_HOME能显示出来,说明你在Shell的环境变量里至少设置了。

Mac或者Linux的环境变量“最全局”的设置应该是在/etc/profile吧?加在这里试试吧。

再细说一下这个问题。可以在Shadow的源码中全局搜索一下ANDROID_HOME 应该可以看出来,Shadow不是特别有什么逻辑需要这个环境变量。特别提到需要设置这个环境变量是因为Android Studio会自动创建local.properties文件,在里面自动填上sdk路径,这样就不需要设置ANDROID_HOME 环境变量了。但是Android Studio才刚刚开始支持复合构建工程,它没能正确的自动为子构建创建local.properties文件。所以,我认为直接设置ANDROID_HOME 环境变量是最省事的做法。另外一种解决方法是将local.properties文件复制到projects/sdk/codingprojects/sdk/coreprojects/sdk/dynamic三个目录中。

from shadow.

HubertYoung avatar HubertYoung commented on May 16, 2024 5

我用的是Mac,终端执行下这行就没事了 launchctl setenv ANDROID_HOME /Users/hubert/opt/sdk
把后面的路径换成你本机的sdk路径就ok了

from shadow.

fso918 avatar fso918 commented on May 16, 2024 1

我昨天也碰到这个问题,升级到AS3.4.1就好了

from shadow.

ideav5 avatar ideav5 commented on May 16, 2024

+1

from shadow.

shifujun avatar shifujun commented on May 16, 2024

这应该是一个一般性的如何设置环境变量并使其生效的问题。简单说,设置之后重启一下是最省事的办法了。

from shadow.

ljk01200120 avatar ljk01200120 commented on May 16, 2024

你看看我上面贴的那图,我都echo $ANDROID_HOME, 都显示路径了,我老早就设置了,不是一天两天了

from shadow.

macarthor avatar macarthor commented on May 16, 2024

我的也是报错,用AS 3.4.1 x64打开的
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

local.properties

ndk.dir=D:\ProgramsOthers\Permanent\AndroidSDK\ndk-bundle
sdk.dir=D:\ProgramsOthers\Permanent\AndroidSDK

from shadow.

 avatar commented on May 16, 2024

androidStudio 启动的环境和你设置ANDROID_HOME的环境不一致的问题.
在可以输出echo $ANDROID_HOME的环境下, 用命令行启动 androidstudio 应该就没问题了.

from shadow.

jiasonwang avatar jiasonwang commented on May 16, 2024

如果 ANDROID_HOME 在.bashprofile 中定义,试着在它前面添加 export 指令。

from shadow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.