UP主本一个java后端,但因公司业务需要,不得不亲自操刀前端,由于最最近项目需要把一个项目thingsboard的ui打包成andriud,所以更是不得不学起了安卓的一些常用工具,首页感谢https://www.iotschool.com/topics/247的博主对thingsboard 打包成APP的详细讲解,按照上述博主的步骤来,到最后一步各种扎心,特此在这记录一下本人所遇到的一些问题(由于我大天朝有一堵伟大的墙,所以这个墙的事情大伙自己想办法吧)
问题1:
从错误中,我们能看到是gradle下载不下来的问题,于是按照网上的一顿骚操作,把build.gradle配置文件改成了如下图所示,
改成阿里云镜像,发现还是不行,网上又说是代理问题,好吧,再次进入C:\Users\Administrator\.gradle 把gradle的配置文件的代理全注释掉,并新建init.gradle,里面内容是:
allprojects{
repositories {
def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
remove repo
}
if (url.startsWith('https://jcenter.bintray.com/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
remove repo
}
}
}
maven {
url ALIYUN_REPOSITORY_URL
url ALIYUN_JCENTER_URL
}
}
}
结果还是不行,到此处,本人心态有点炸了,于是各种检查,网上说使用阿里云镜像时得用http,于是反其道而行之,我使用了https,结果尽然能下载了,但又再次碰到了新的问题,如下图所示:
哎,突然觉得心好累!
于是进入terminal 进行gradle clean ,再次报错,
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.internal.version-check']
> Minimum supported Gradle version is 6.1.1. Current version is 5.4.1. If using the gradle wrapper, try editing the distributionUrl in F:\thingsboard\ui\YoxvIoT\platforms\android\gradle\wrapper\gradle-wrapper.properties to gradle-6.1.1-all.zip
* 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 21s
一看是版本问题,于是去https://services.gradle.org/distributions/ 下了一个新版本放在C:\Users\Administrator\.gradle\wrapper\dists 目录下,发现
又报错,
于是基本可以确定是gradle的版本不一致的问题,再次跑到C:\Users\Administrator\AppData\Local\Android\Sdk\tools\bin下去执行 ./sdkmanager --update 和 ./sdkmanager --license
最后安装包 :sdkmanager "platform-tools" "build-tools;28.0.3" "platforms;android-28"
故事到此结束 一切顺利搞定!!!