java - 当我打开在 android studio 中创建的应用程序时,如何解决这个错误?
问题描述
我在 android studio 中制作了一个应用程序,它对我有用。我尝试导出 apk 来测试它,它工作正常。到目前为止,一切都很好。
然后,当我将它上传到 PlayStore 时,我安装了它,当我尝试打开它时,我无法打开它,我错过了一个包含在捕获中的错误。
我认为出现错误的应用程序代码部分是这样的:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.facebook.fresco:fresco:1.11.0'
implementation 'com.facebook.fresco:webpsupport:1.11.0'
implementation 'com.facebook.fresco:animated-webp:1.11.0'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
}
这是 build.gradle 代码:
apply plugin: 'com.android.application'
android {
//the compression of webp file during build causes problem with FileDescriptor in ContentProvider.
aaptOptions {
noCompress "webp"
}
compileSdkVersion 28
defaultConfig {
applicationId "com.shstickers.shstickers"
minSdkVersion 16
targetSdkVersion 28
versionCode 17
versionName "1.27"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
def contentProviderAuthority = applicationId + ".stickercontentprovider"
// Creates a placeholder property to use in the manifest.
manifestPlaceholders =
[contentProviderAuthority: contentProviderAuthority]
// Adds a new field for the authority to the BuildConfig class.
buildConfigField("String",
"CONTENT_PROVIDER_AUTHORITY",
"\"${contentProviderAuthority}\"")
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
task checkDebug {
doLast {
println("checkDebug")
if (android.defaultConfig.applicationId.startsWith("com.whatsapp")) {
throw new GradleException("applicationId in defaultConfig cannot start with com.whatsapp, please change your applicationId in app/build.gradle");
}
checkApplicationIdInDebug()
}
}
private void checkApplicationIdInDebug() {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def ignoreApplicationIdCheck = properties.getProperty('ignoreApplicationIdCheck')
if (ignoreApplicationIdCheck == null) {
if (android.defaultConfig.applicationId.equals("com.example.samplestickerapp")) {
throw new GradleException("Your applicationId is currently com.example.samplestickerapp, please change your applicationId to a different string in app/build.gradle in line 16");
}
} else {
println("application id check ignored")
}
}
task checkRelease {
doLast {
println("checkRelease")
if (android.defaultConfig.applicationId.startsWith("com.example")) {
throw new GradleException("applicationId in defaultConfig cannot start with com.example, please change your applicationId in app/build.gradle");
}
}
}
tasks.whenTaskAdded { task ->
println(task.name)
if (task.name.contains("assembleDebug")) {
task.dependsOn checkDebug
}
if (task.name.contains("assembleRelease")) {
task.dependsOn checkRelease
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.facebook.fresco:fresco:1.11.0'
implementation 'com.facebook.fresco:webpsupport:1.11.0'
implementation 'com.facebook.fresco:animated-webp:1.11.0'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
}
知道如何解决吗?安装后在移动设备上打开应用程序时出现的错误作为捕获附加。
解决方案
推荐阅读
- php - PHP 如何插入嵌套元素 Libreoffice 样式
- r - 有缺失值的条件语句
- mysql - 如何使用 phpMyAdmin 为具有默认空格的 Null 值字段导入 ods 文件
- java - 如何摆脱 KVM VM 中 java 和 php 进程之间的进程间通信中的 tcp-ip 发送延迟
- java - 如何解决由 JAXB 语句引起的异常?
- java - 如何在 Java 中使用 Selenium 提交表单
- javascript - 如果用户在出站呼叫中未接听,Twilio 会发送语音消息
- android - 在 NestedScrollView 中使用 RecyclerView 进行分页
- python - 错误=193,%1 不是一个有效的 Win32 应用程序,它带有到 Python 脚本的管道
- dart - 尝试使用导航器页面访问时找不到 Flutter scoped_model