首页 > 为什么这个项目的gradle无法联网?

为什么这个项目的gradle无法联网?

项目是中途从别人那拿来的eclipse项目,我转成studio了.
里面现在有一个主程序的gradle,还需要添加什么才能联网吗?还是这个有问题?

apply plugin: 'com.android.application'

android {
    sourceSets.main.jniLibs.srcDirs = ['libs']
    compileSdkVersion 21
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.fenghua.traffic"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 122
        versionName "1.2.02"
    }


    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}


buildscript {
    repositories {
        jcenter()
    }
    dependencies {
//        classpath 'com.android.tools.build:gradle:2.1.0'
        classpath 'com.android.tools.build:gradle:2.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}


dependencies {
    compile fileTree(include: '*.jar', dir: 'libs')
    compile ('com.android.support:appcompat-v7:22.2.1'){
        exclude group: "com.android.support", module: "support-v4"
    }
    compile project(':IMKit')
    compile project(':circleimageview')
}

联网权限的问题,可以试一下楼上的方法。


gradle联网?第一次听到这种说法,gradle跟联网没有关系。如果是应用存在网络请求操作,则要在AndroidManifest.xml中添加权限<uses-permission android:name="android.permission.INTERNET" />


你看一下项目中的gradle.properties,看里面有没有设置proxy。有可能是因为设置了proxy,所以无法访问网络。


gradle联网?第一次听到这种说法,gradle跟联网没有关系。如果是应用存在网络请求操作,则要在AndroidManifest.xml中添加权限<uses-permission android:name="android.permission.INTERNET" />

【热门文章】
【热门文章】