当我使用Proguard发布应用程序时,运行apk文件然后崩溃。这是我的build.grade和Proguard-rules.pro文件。
build.grade
$(document).ready(function () {
//next click
$(':submit').click(function (e) {
e.preventDefault();
data = $('form').serialize() + "&submit=" + $(this).val();
$.ajax({
url :"quiz.php",
data : data,
type : "POST",
success : function (d) {
$('body').html(d); //reload `quiz.js`
}
});
});
var countdown = 1 * 60 * 1000; //Here problem -> after ajax called reinitialize value
var timeload = setInterval(function () {
countdown -= 1000;
var min = Math.floor(countdown / (60 * 1000));
var sec = Math.floor((countdown - (min * 60 * 1000)) / 1000);
if (countdown <= 0) {
alert("5 min!");
clearInterval(timeload);
} else {
$("#time").html(min + " : " + sec);
}
}, 1000);
Proguard-rules.pro
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "cheng.cunghoangdao.cungbachduong"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.github.noobknight:app:1.0.0'
compile 'com.jakewharton:butterknife:8.1.0'
apt 'com.jakewharton:butterknife-compiler:8.1.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'org.jsoup:jsoup:1.9.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.jpardogo.googleprogressbar:library:1.2.0'
compile files('libs/apache-commons-lang.jar')
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.5.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile 'com.google.firebase:firebase-messaging:9.2.0'
compile project(':library')
}
apply plugin: 'com.google.gms.google-services'
我认为在proguard-reles.pro中配置缺少库。请建议我......
答案 0 :(得分:1)
如果没有明确的
,Proguard会删除它们使用此:
-keep class xxxx, keep class yyyy, etc
检查所有课程。