当我将它作为调试版本导出时,该应用程序正常工作,完全没有错误,但是当我将其作为发行版本导出时,它会在启动时崩溃。
我已经附加了Android监视器的错误
10-24 03:02:02.286 17303-17303/? E/CustomizationReader: appName = Prism
10-24 03:02:02.287 17303-17303/? E/CustomizationReader: key = sku_id
10-24 03:02:02.287 17303-17303/? E/CustomizationReader: Result = 33
10-24 03:02:02.531 24402-24402/? E/dalvikvm: Could not find class 'kotlin.jvm.internal.PropertyReference1Impl', referenced from method com.earnso.mangaworld.util.RarContentProvider.<clinit>
10-24 03:02:02.549 24402-24402/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.earnso.mangaworld, PID: 24402
java.lang.NoClassDefFoundError: kotlin.jvm.internal.PropertyReference1Impl
at com.earnso.mangaworld.util.RarContentProvider.<clinit>(RarContentProvider.kt)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1215)
at android.app.ActivityThread.installProvider(ActivityThread.java:5037)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4623)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4563)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
at dalvik.system.NativeStart.main(Native Method)
10-24 03:02:02.862 1130-1350/? E/cm_cmc_c: app launch:com.earnso.mangaworld
10-24 03:02:03.297 24442-24442/? E/dalvikvm: Could not find class 'android.os.LocaleList', referenced from method com.domobile.applock.aa.a
10-24 03:02:03.491 24442-24442/? E/dalvikvm: Could not find class 'android.graphics.drawable.AdaptiveIconDrawable', referenced from method com.domobile.applock.aa.r
10-24 03:02:03.769 24442-24442/? E/dalvikvm: Could not find class 'android.app.job.JobScheduler', referenced from method com.google.android.gms.internal.zzcjg.z
10-24 03:02:03.770 24442-24442/? E/dalvikvm: Could not find class 'android.app.job.JobScheduler', referenced from method com.google.android.gms.internal.zzcjg.a
10-24 03:02:04.062 1130-1350/? E/cm_cmc_c: app launch:com.htc.launcher
10-24 03:02:04.080 24442-24442/? E/dalvikvm: Could not find class 'android.app.usage.UsageStatsManager', referenced from method com.domobile.applock.service.LockService.onCreate
10-24 03:02:04.104 24442-24442/? E/eLock: startWatching
10-24 03:02:09.807 829-829/? E/StatusBar.BatteryControllerHTC: battery level = 84, plugged = true, isChargingProtection = true
10-24 03:02:12.308 739-762/? E/WindowManager: Starting window AppWindowToken{432983f0 token=Token{42f86568 ActivityRecord{42aeee78 u0 com.earnso.mangaworld/.ui.main.MainActivity t947}}} timed out
10-24 03:02:16.404 17303-17754/? E/Prism.WidgetManager: The same lists. No need to update. skip it.
10-24 03:02:19.775 829-829/? E/StatusBar.BatteryControllerHTC: battery level = 84, plugged = true, isChargingProtection = true
10-24 03:02:29.814 829-829/? E/StatusBar.BatteryControllerHTC: battery level = 84, plugged = true, isChargingProtection = true
10-24 03:02:31.433 1130-24563/? E/NativeCrypto: ssl=0x63b441f8 cert_verify_callback x509_store_ctx=0x68dd2940 arg=0x0
10-24 03:02:31.438 1130-24563/? E/NativeCrypto: ssl=0x63b441f8 cert_verify_callback calling verifyCertificateChain authMethod=ECDHE_RSA
10-24 03:02:39.811 829-829/? E/StatusBar.BatteryControllerHTC: battery level = 85, plugged = true, isChargingProtection = true
10-24 03:02:42.729 31423-31423/? E/SS3StatQuery: ScreenSaver3Activity changeScreenStat false
10-24 03:02:47.732 17303-18963/? E/Prism.MastheadStatePro_: uri: content://com.htc.launcher.masthead_state/visibility
10-24 03:02:47.741 17303-24059/? E/Prism.MastheadStatePro_: uri: content://com.htc.launcher.masthead_state/visibility
10-24 03:02:47.965 739-1035/? E/RemoteViews: ANR Warning,RemoteViews can only be used once ,if not ,it may cause ANR in hosts such as Laucher,SystemUI. keys for search <ANR Exception MSG History>
10-24 03:02:48.218 17303-24721/? E/Prism.MastheadStatePro_: uri: content://com.htc.launcher.masthead_state/panelstatus?notify=false
10-24 03:02:49.782 829-829/? E/StatusBar.BatteryControllerHTC: battery level = 85, plugged = true, isChargingProtection = true
10-24 03:02:59.810 829-829/? E/StatusBar.BatteryControllerHTC: battery level = 85, plugged = true, isChargingProtection = true
这是应用程序级别的gradle文件。
import java.text.SimpleDateFormat
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
if (file("custom.gradle").exists()) {
apply from: "custom.gradle"
}
ext {
// Git is needed in your system PATH for these commands to work.
// If it's not installed, you can return a random value as a workaround
getCommitCount = {
return 'git rev-list --count HEAD'.execute().text.trim()
// return "1"
}
getGitSha = {
return 'git rev-parse --short HEAD'.execute().text.trim()
// return "1"
}
getBuildTime = {
def df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
df.setTimeZone(TimeZone.getTimeZone("UTC"))
return df.format(new Date())
}
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
publishNonDefault true
dexOptions {
// Prevent OutOfMemory with MultiDex during the build phase
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.earnso.mangaworld"
minSdkVersion 16
targetSdkVersion 26
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionCode 26
versionName "0.6.3"
buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\""
buildConfigField "String", "BUILD_TIME", "\"${getBuildTime()}\""
buildConfigField "boolean", "INCLUDE_UPDATER", "false"
vectorDrawables.useSupportLibrary = true
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86"
}
}
buildTypes {
debug {
//versionNameSuffix "-${getCommitCount()}"
//applicationIdSuffix ".debug"
multiDexEnabled true
}
release {
minifyEnabled false
//shrinkResources true
multiDexEnabled true
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
standard {
buildConfigField "boolean", "INCLUDE_UPDATER", "true"
}
fdroid {
}
dev {
minSdkVersion 16
resConfigs "en", "xxhdpi"
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
}
lintOptions {
abortOnError false
checkReleaseBuilds false
}
}
dependencies {
// Modified dependencies
// Android support library
final support_library_version = '26.1.0'
// ReactiveX
// Network client
// REST
final retrofit_version = '2.3.0'
compile "com.squareup.retrofit2:retrofit:$retrofit_version"
compile "com.squareup.retrofit2:converter-gson:$retrofit_version"
compile "com.squareup.retrofit2:adapter-rxjava:$retrofit_version"
// JSON
// YAML
// JavaScript engine
// Disk
// HTML parser
// Job scheduling
// Changelog
// Database
// Model View Presenter
final nucleus_version = '3.0.0'
compile "info.android15.nucleus:nucleus:$nucleus_version"
compile "info.android15.nucleus:nucleus-support-v7:$nucleus_version"
// Dependency injection
// Image library
final glide_version = '4.2.0'
compile "com.github.bumptech.glide:glide:$glide_version"
compile "com.github.bumptech.glide:okhttp3-integration:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
// Transformations
// Logging
// Crash reports
// Sort
// UI
compile('com.afollestad.material-dialogs:core:0.9.4.7') {
exclude group: "com.android.support", module: "support-v13"
}
// Conductor
// RxBindings
final rxbindings_version = '1.0.1'
compile "com.jakewharton.rxbinding:rxbinding-kotlin:$rxbindings_version"
compile "com.jakewharton.rxbinding:rxbinding-appcompat-v7-kotlin:$rxbindings_version"
compile "com.jakewharton.rxbinding:rxbinding-support-v4-kotlin:$rxbindings_version"
compile "com.jakewharton.rxbinding:rxbinding-recyclerview-v7-kotlin:$rxbindings_version"
// Tests
final robolectric_version = '3.1.4'
testCompile "org.robolectric:robolectric:$robolectric_version"
testCompile "org.robolectric:shadows-multidex:$robolectric_version"
testCompile "org.robolectric:shadows-play-services:$robolectric_version"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
final coroutines_version = '0.19.1'
compile 'com.github.inorichi:subsampling-scale-image-view:01e5385'
compile 'com.github.inorichi:tachimage:68cd311'
compile 'com.github.inorichi:junrar-android:634c1f5'
compile 'com.android.support:multidex:1.0.1'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.3.2'
compile 'com.jakewharton.rxrelay:rxrelay:1.2.0'
compile 'com.f2prateek.rx.preferences:rx-preferences:1.0.2'
compile 'com.github.pwittchen:reactivenetwork:0.7.0'
compile 'com.squareup.okhttp3:okhttp:3.9.0'
compile 'com.squareup.okio:okio:1.13.0'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.github.salomonbrys.kotson:kotson:2.5.0'
compile 'com.github.bmoliveira:snake-yaml:v1.18-android'
compile 'com.squareup.duktape:duktape-android:1.2.0'
compile 'com.jakewharton:disklrucache:2.0.2'
compile 'com.github.seven332:unifile:1.0.0'
compile 'org.jsoup:jsoup:1.10.2'
compile 'com.evernote:android-job:1.1.11'
compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile 'com.github.gabrielemariotti.changeloglib:changelog:2.1.0'
compile 'com.pushtorefresh.storio:sqlite:1.13.0'
compile 'uy.kohesive.injekt:injekt-core:1.16.1'
compile 'jp.wasabeef:glide-transformations:3.0.1'
compile 'com.jakewharton.timber:timber:4.5.1'
compile 'ch.acra:acra:4.9.2'
compile 'com.github.gpanther:java-nat-sort:natural-comparator-1.1'
compile 'com.dmitrymalkovich.android:material-design-dimens:1.4'
compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
compile 'eu.davidea:flexible-adapter:5.0.0-rc1'
compile 'com.nononsenseapps:filepicker:2.5.2'
compile 'com.github.amulyakhare:TextDrawable:558677e'
compile 'me.zhanghai.android.systemuihelper:library:1.0.0'
compile 'com.nightlynexus.viewstatepageradapter:viewstatepageradapter:1.0.4'
compile 'com.github.mthli:Slice:v1.2'
compile 'com.bluelinelabs:conductor:2.1.4'
compile 'com.github.inorichi:conductor-support-preference:26.0.2'
compile 'com.google.android.gms:play-services-ads:11.0.4'
testCompile 'junit:junit:4.12'
testCompile 'org.assertj:assertj-core:1.7.1'
testCompile 'org.mockito:mockito-core:1.10.19'
compile "com.android.support:support-v4:$support_library_version"
compile "com.android.support:appcompat-v7:$support_library_version"
compile "com.android.support:cardview-v7:$support_library_version"
compile "com.android.support:design:$support_library_version"
compile "com.android.support:recyclerview-v7:$support_library_version"
compile "com.android.support:preference-v7:$support_library_version"
compile "com.android.support:support-annotations:$support_library_version"
compile "com.android.support:customtabs:$support_library_version"
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
compile 'com.google.android.gms:play-services-ads:11.0.4'
}
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
repositories {
mavenCentral()
}
kotlin {
experimental {
coroutines 'enable'
}
}
// add support for placeholders in resource files
//https://code.google.com/p/android/issues/detail?id=69224
def replacePlaceholdersInFile(basePath, fileName, placeholders) {
def file = new File(basePath, fileName);
if (!file.exists()) {
logger.quiet("Unable to replace placeholders in " + file.toString() + ". File cannot be found.")
return;
}
logger.debug("Replacing placeholders in " + file.toString())
logger.debug("Placeholders: " + placeholders.toString())
def content = file.getText('UTF-8')
placeholders.each { entry ->
content = content.replaceAll("\\\$\\{${entry.key}\\}", entry.value)
}
file.write(content, 'UTF-8')
}
afterEvaluate {
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
output.processResources.doFirst {
// prepare placeholder map from manifestPlaceholders including applicationId placeholder
def placeholders = variant.mergedFlavor.manifestPlaceholders + [applicationId: variant.applicationId]
replacePlaceholdersInFile(resDir, 'xml-v25/shortcuts.xml', placeholders)
}
}
}
}
在调试版本的基础上工作完全正常,但只要我将其转移到发布版本就会崩溃。
答案 0 :(得分:0)
完全关闭Android Studio。清理并重建项目。