[英]Build Android APK in Redhat using Gradle in Offline mode
I am using Gradle 2.13 and trying to build android apk in readhat and system does not have internet access. 我正在使用Gradle 2.13并尝试在readhat中构建android apk,并且系统无法访问互联网。 I am trying to build android apk offline.
我正在尝试离线构建android apk。 But it is throwing some exception and not able to figure out what went wrong.
但这引发了一些异常,无法找出问题所在。
Main build.gradle 主要build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Error: 错误:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'PROJECT'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.1.0.
Required by:
:PROJECT:unspecified
> No cached version of com.android.tools.build:gradle:2.1.0 available for offline mode.
> No cached version of com.android.tools.build:gradle:2.1.0 available for offline mode.
* 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: 0.831 secs
Version : 版本号:
gradle -version
Gradle 2.13
摇篮2.13
Is there any tutorial available to build an offline apk in redhat/linux machine? 是否有任何教程可用于在redhat / linux机器上构建脱机apk?
Edit: Update the question. 编辑:更新问题。
It happens because the gradle plugin for android 2.13 doesn't exist . 这是因为android 2.13的gradle插件不存在 。
The latest stable version is 2.1.0. 最新的稳定版本是2.1.0。 Use:
采用:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
Don't confuse gradle distribution and the android plugin for gradle . 不要混淆gradle分发和gradle的android插件 。
You can define the gradle distribution used by a project in the file gradle/wrapper/gradle-wrapper.properties
您可以在
gradle/wrapper/gradle-wrapper.properties
文件中定义项目使用的gradle分布
For example: 例如:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.