有时候 ,咱们在调试APK,直接Build是能够正常生成,没有报错,可是当咱们将本身的签名文件加上去,就会报错。通常状况下,咱们能够在build.gradle中的android{}里面添加一个东西html
lintOptions { checkReleaseBuilds false abortOnError false }
整个文件以下:java
apply plugin: 'com.android.application' android { compileSdkVersion 16 buildToolsVersion "26.0.1" defaultConfig { applicationId "com.zhongxuan.himclient" minSdkVersion 11 targetSdkVersion 17 } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } lintOptions { checkReleaseBuilds false abortOnError false } } dependencies { compile files('libs/zxing.jar') compile files('libs/gson-2.6.1.jar') compile files('libs/xUtils-2.6.14.jar') }
参考连接:http://dditblog.com/itshare_657.htmlandroid
还有一种错误app
Error: Expected resource of type styleable [ResourceType]
这个错误在编译运行时候并不会出现,可是当须要编译打包的时候,就会爆出这个异常。gradle
这种错误,只须要在提示错误的类里面加入这句:ui
@SuppressWarnings("ResourceType")spa
例如:.net
@SuppressWarnings("ResourceType") public void initView() { TypedArray ta = mContext.obtainStyledAttributes(attrs); boolean hasBottomLine = ta.getBoolean(0, false); boolean hasTopLine = ta.getBoolean(1, false); ta.recycle(); }
参考连接:http://blog.csdn.net/zhufuing/article/details/50901133调试