赞
踩
下载gradle包
wget https://services.gradle.org/distributions/gradle-5.4.1-all.zip
下载android-sdk
wget https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
分别解压
unzip gradle-5.4.1-all.zip
tar xvzf android-sdk_r24.4.1-linux.tgz
进入解压后的android-sdk-linux/tools目录
输入./android update sdk --no-ui
同意开始更新
配置环境变量:
vim /etc/profile
export PATH=/yourpath/gradle-5.4.1/bin:$PATH
export PATH=/yourpath/android-sdk-linux/tools:$PATH
上传android项目工程
在工程根目录进行出包测试:assembleRelease
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/data/SJSDK-For-H5/BasePackage/BridgeTest/local.properties'.
* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
SDK location not found,修改local.properties中的sdk指向
重新测试
FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'. > Failed to install the following Android SDK packages as some licences have not been accepted. build-tools;28.0.3 Android SDK Build-Tools 28.0.3 To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager. Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html Using Android SDK: /root/download/android-sdk-linux * 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 9s
Build-Tools 28.0.3没有license
执行android list sdk --all 寻找匹配的序号
Packages available for installation or update: 235
1- Android SDK Tools, revision 25.2.5 (Obsolete)
2- Android SDK Platform-tools, revision 29.0.6
3- Android SDK Build-tools, revision 30 rc1
4- Android SDK Build-tools, revision 29.0.3
5- Android SDK Build-tools, revision 29.0.2
6- Android SDK Build-tools, revision 29.0.1
7- Android SDK Build-tools, revision 29
8- Android SDK Build-tools, revision 28.0.3
9- Android SDK Build-tools, revision 28.0.2
10- Android SDK Build-tools, revision 28.0.1
11- Android SDK Build-tools, revision 28
12- Android SDK Build-tools, revision 27.0.3
可以看出匹配的是 8
执行 android update sdk -u -a -t 8 询问时输入 “y” 并耐心等待
January 16, 2019
Do you accept the license 'android-sdk-license-e6a904e8' [y/n]: y
Installing Archives:
Preparing to install archives
Downloading Android SDK Build-tools, revision 28.0.3
Installing Android SDK Build-tools, revision 28.0.3
Installed Android SDK Build-tools, revision 28.0.399%)
Done. 1 package installed.
再次尝试,如果报错再重复以上操作
Observed package id 'build-tools;30.0.0-rc1' in inconsistent location '/root/download/android-sdk-linux/build-tools/30.0.0-preview' (Expected '/root/download/android-sdk-linux/build-tools/30.0.0-rc1')
看样子是没有30.0.0-rc1,去到我们的目录底下看,果然只有30.0.0-preview
android update sdk -u -a -t 3
没有出现30.0.0-rc1
重新编译之后是可以的
关注我的公众号(不是技术号),让你的职业发展除技术外,多一种可能
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。