您好,我已经安装在Ubuntu Android Studio中,旨在将它们与React Native,Cordova,Phonegap等配合使用。
我在该网站上搜索了其他问题,并尝试了他们提供的解决方案,但是到目前为止,结果是我接下来显示的内容,经过10天的安装和测试,我决定问我一个问题。
我是按照Android Studio的官方页面并以几种方式进行安装的,但无法正常工作。
现在,我可以通过以下方式进行安装,以避免权限问题:
将已下载的文件夹从Android Studio复制到/usr/local/
对于SDK,我在个人文件夹/home/charly/Android/sdk/
sudo apt-get install libc6: i386 libncurses5: i386 libstdc ++ 6: i386 lib32z1 lib32bz2-1.0
安装必要的库要运行Android Studio安装程序,我使用终端将其放置在bin文件夹中的Android Studio位置:
cd/usr/local/android-studio/bin
./studio.sh
我编辑.bashrc文件:sudo vim ~/.bashrc
并将以下内容添加到文件末尾:
export PATH = $ {PATH}:/ home / charly / Android / sdk / tools 导出PATH = $ {PATH}:/ home / charly / Android / sdk / platform-tools
sudo apt-get安装lib32stdc ++ 6 sudo apt-get install lib32z1
android sdk
和android avd
时,答案是:找不到订单«android»。我什么时候应该分别使用SDK Manager和AVD Manager。此外,还有另一个问题,执行printenv ANDROID_HOME
时,控制台的结果为:/opt/android-sdk/
并且在此文件夹中不是Android Studio。
当我尝试从React Native运行Android应用程序时:react-native run-android我收到错误消息:
S server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug) ...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ': app'.
> The SDK directory '/ opt / android-sdk' does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Command failed: ./gradlew installDebug
Error: Command failed: ./gradlew installDebug
at checkExecSyncError (child_process.js: 611: 11)
at Object.execFileSync (child_process.js: 629: 13)
at runOnAllDevices (/home/charly/proyec/App/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
at buildAndRun (/home/charly/proyect/App/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
at isPackagerRunning.then.result (/home/charly/proyect/App/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12)
at process._tickCallback (internal / process / next_tick.js: 68: 7)
我该如何解决这些问题?
如果我将.bashrc设置为在'/opt/android-sdk'
中,为什么它会告诉我home/charly/Android/sdk
中不存在SDK?
也许这个问题很广泛,但是我想解释一下整个安装过程,他们可以看到我在此过程中犯的错误。 谢谢
答案 0 :(得分:0)
您需要在您的bash启动脚本之一中设置ANDROID_HOME环境变量。 elsewhere on Stackoverflow.
对此进行了详细说明或者,您可以add a local.properties file配置SDK的位置。