简体   繁体   中英

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. I am trying to build android apk offline. But it is throwing some exception and not able to figure out what went wrong.

Main 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

Is there any tutorial available to build an offline apk in redhat/linux machine?

Edit: Update the question.

It happens because the gradle plugin for android 2.13 doesn't exist .

The latest stable version is 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 .

You can define the gradle distribution used by a project in the file gradle/wrapper/gradle-wrapper.properties

For example:

   distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM