NativeActivity Sample : Error Unknown host 'jc

2019-08-09 03:04发布

问题:

I tried building the nativeActivity code from the samples in Android Studio 1.5.1 but I am getting this error :

    Error:Unknown host 'jcenter.bintray.com'. You may need to adjust the proxy settings in Gradle.
   Enable Gradle 'offline mode' and sync 
   Learn about configuring HTTP proxies in Gradle</a>

I didn't find this issue with the projects not using Experimental Plugin (com.android.tools.build:gradle-experimental:0.4.0') as used by all the Native samples from the android git hub.

my Project:NativeActivity build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
       jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle-experimental:0.4.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

回答1:

f you're unable to open this path

https://bintray.com/android/android-tools/com.android.tools.build.gradle-experimental/0.4.0/view#files/com/android/tools/build/gradle-experimental.

Using proxy try again.

  • run a proxy like freegate

  • the root path project in cmd type gradlew -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8580