Android Studio Build APK沒有報錯,但是Generate signed apk報錯


有時候 ,我們在調試APK,直接Build是可以正常生成,沒有報錯,但是當我們將自己的簽名文件加上去,就會報錯。一般情況下,我們可以在build.gradle中的android{}里面添加一個東西

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

  整個文件如下:

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.html

還有一種錯誤

Error: Expected resource of type styleable [ResourceType] 
這個錯誤在編譯運行時候並不會出現,但是當需要編譯打包的時候,就會爆出這個異常。

這種錯誤,只需要在提示錯誤的類里面加入這句:

@SuppressWarnings("ResourceType")

例如:

@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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM