有時候 ,咱們在調試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調試