《完美解决系列》Android Studio中提示找不到符号错误
在编译apk时,提示以下错误。错误: 找不到符号符号:类 xxx位置: 程序包 xxx.set.network问题原因,是因为android studio gradle 错误。使用环境为:我的主项目中引用了一个module。module完整的build.gradle如下apply plugin: 'com.android.library'android {compileSdk
·
在编译apk时,提示以下错误。
错误: 找不到符号
符号: 类 xxx
位置: 程序包 xxx.set.network
问题原因,是因为android studio gradle 错误。
使用环境为:我的主项目中引用了一个module。
module完整的build.gradle如下
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jniLibs.srcDirs =['libs']
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}
里面带有release,所以会导致主项目不能正常生成apk。
解决方法
把release注释掉即可,引用的module不能包含release。
注释掉以后完整的build.gradle为:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
// buildTypes {
// release {
// minifyEnabled true
// zipAlignEnabled true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// }
// }
sourceSets {
main {
jniLibs.srcDirs =['libs']
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}
更多推荐
已为社区贡献3条内容
所有评论(0)