如何解决Android Studio问题



您好,我已经安装了我的Ubuntu Android Studio,目的是将其与React Antial,Cordova,Phonegap等使用SDK一起使用。

我已经在此网站上搜索了其他问题,并尝试了他们提供的解决方案,但到目前为止,我接下来显示的内容是在安装和测试10天后,我决定问我的问题。

我根据Android Studio的官方页面以及几种方式进行了安装,但我无法正常工作。

现在我已经安装了以下方式,以避免权限问题:

  • 将下载的文件夹从Android Studio复制到/usr/local/

  • 对于SDK,我在个人文件夹/home/charly/Android/sdk/

    中选择了一个文件夹
    • 安装32位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,然后将以下内容添加到文件末尾:

    导出路径= $ {路径}:/home/charly/android/sdk/tools导出路径= $ {path }:/home/home/charly/android/sdk/platform-tools

    • 安装:

    sudo apt-get安装lib32stdc 6sudo apt-get安装lib32z1

    • 当我运行android sdkandroid avd时,答案是:order«android»找不到。我何时应该分别担任SDK Manager和AVD Manager。

另外,还有另一个问题,当执行printenv ANDROID_HOME时,控制台的结果为:/opt/android-sdk/,在此文件夹中不是Android Studio。

当我尝试从React Native运行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说它们在home/charly/Android/sdk中,为什么会告诉我'/opt/android-sdk'中不存在SDK?

也许这个问题是广泛的,但是我想解释整个安装,他们可以看到我在这个错误中犯的错误。谢谢

您需要在一个bash启动脚本中设置android_home环境变量。这是在Stackoverflow上其他地方详细说明的。

另外,您可以添加local.properties文件以配置SDK位置。

相关内容

最新更新