在离线模式下使用 Gradle 在 Redhat 中构建 Android APK
Build Android APK in Redhat using Gradle in Offline mode
我正在使用 Gradle 2.13 并尝试在 readhat 中构建 android apk,但系统无法访问互联网。
我正在尝试离线构建 android apk。但它抛出了一些异常,无法弄清楚出了什么问题。
主要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()
}
}
错误:
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
版本:
gradle -version
Gradle 2.13
是否有在 redhat/linux 机器上构建离线 apk 的教程?
编辑:更新问题。
这是因为 android 2.13 的 gradle 插件不存在 。
最新稳定版为2.1.0。使用:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
不要混淆 gradle 发行版 和 gradle 的 android 插件。
您可以在文件中定义项目使用的 gradle 发行版
gradle/wrapper/gradle-wrapper.properties
例如:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
我正在使用 Gradle 2.13 并尝试在 readhat 中构建 android apk,但系统无法访问互联网。 我正在尝试离线构建 android apk。但它抛出了一些异常,无法弄清楚出了什么问题。
主要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()
}
}
错误:
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
版本:
gradle -version
Gradle 2.13
是否有在 redhat/linux 机器上构建离线 apk 的教程?
编辑:更新问题。
这是因为 android 2.13 的 gradle 插件不存在 。
最新稳定版为2.1.0。使用:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
不要混淆 gradle 发行版 和 gradle 的 android 插件。
您可以在文件中定义项目使用的 gradle 发行版
gradle/wrapper/gradle-wrapper.properties
例如:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip