《完美解决系列》Android(安卓)Studio中提示找不到符号错误
16lz
2021-01-26
在编译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'}
更多相关文章
- Attribute is missing the Android(安卓)namespace prefix
- Android二维码开源项目zxing编译
- Android(安卓)ADB server didn't ACK 错误解决
- Android中Framgment的构造函数
- android studio 更新 Gradle错误解决方法 sync gradle failed
- android4.0编译错误集(一)
- [置顶] Android项目的错误异常收集日志记录
- eclipse ADT插件安装碰到的错误
- android 编译java.util.zip.ZipException: error in opening zip