我正在尝试使用无图形界面在Ubuntu服务器上构建Android应用程序。 sdk位于安装在/ mnt / data中的磁盘上,因为根目录没有足够的空间。我使用以下命令安装了Android SDK的所有软件包:($ ALLVERSIONS只是一个字符串,1,2,3,... 159使用for循环生成,159是列出的可安装项目中的最大数字用android list sdk --all)
android update sdk -u -a -t $ALLVERSIONS
我列出了可能的目标:
android list sdk --all --extended
这表示正在安装以下目标:
id: 27 or "android-22"
Type: Platform
Desc: Android SDK Platform 5.1.1
Revision 2
...
----------
id: 30 or "android-19"
Type: Platform
Desc: Android SDK Platform 4.4.2
Revision 4
但由于某种原因,我尝试构建的每个应用程序(使用gradle或gradle包装器)都会出现如下错误:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> failed to find target android-19 : /mnt/data/android-sdk-linux/platform-tools
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 28.949 secs
或:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> failed to find target with hash string 'android-22' in: /mnt/data/android-sdk-linux/platform-tools
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.414 secs
感谢您的帮助。
编辑:尝试将$ ANDROID_HOME设置为platforms目录而不是platform-tools导致以下内容
ubuntu@androidmonkey:~/working/TraceTester$ ls
app build build.gradle gradle gradle.properties gradlew gradlew.bat settings.gradle TraceTester.iml
ubuntu@androidmonkey:~/working/TraceTester$ ./gradlew assembleDebug
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> failed to find target with hash string 'android-22' in: /home/ubuntu/android-sdk-linux/platforms
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.607 secs
ubuntu@androidmonkey:~/working/TraceTester$ ls /home/ubuntu/android-sdk-linux/platforms
android-10 android-13 android-16 android-19 android-21 android-3 android-6 android-9
android-11 android-14 android-17 android-2 android-22 android-4 android-7
android-12 android-15 android-18 android-20 android-23 android-5 android-8
ubuntu@androidmonkey:~/working/TraceTester$