原博客地址:https://blog.csdn.net/qq_34115898/article/details/79061475
替换gradle-wrapper.properties里面
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
即可,这个为android studio3.0适配问题。
同时,如果还有其他问题,请参考下面apk生成的地方。
apply plugin: 'com.android.application' android { compileSdkVersion 24 buildToolsVersion "26.0.2" defaultConfig { applicationId "com.xiaoniu.wifihotspotdemo" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' applicationVariants.all { variant -> variant.getPackageApplication().outputDirectory = new File(outputDir()) variant.outputs.all { output -> if (variant.buildType.name.equals('release') || variant.buildType.name.equals('debug')) { outputFileName = "example.apk" } } } } } // productFlavors { // kuan {} // xiaomi {} // qh360 {} // baidu {} // wandoujia {} // } // // productFlavors.all { // flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name] // } } def outputDir() { return project.buildDir.absolutePath + "/outputs/apk" } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.4.0' }