javascript - 我该如何解决'在android中不断停止'错误?
问题描述
我正在努力解决在 android 模拟器上显示“不断停止”错误的错误。我搜索了错误的来源,发现每当我在应用程序级别构建 gradle 添加应用插件:'com.google.gms.google-services' 这一行时,我的应用程序都会停止。但是如果我不添加那条线,我就不能再使用 firebase 了。我该如何解决这个问题?你能帮帮我吗?先感谢您。
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.instagram_clone"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation project(':react-native-firebase')
implementation project(':react-native-vector-icons')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "com.google.android.gms:play-services-base:16.1.0"
implementation "com.google.firebase:firebase-core:16.0.8"
implementation "com.google.firebase:firebase-auth:16.2.1"
implementation "com.google.firebase:firebase-firestore:18.2.0"
implementation "com.google.firebase:firebase-storage:17.0.0"
implementation project(':react-native-image-picker')
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services' //this line creates error
解决方案
当你创建一个模拟器时,有一些支持谷歌,一些不支持。确保创建与 Google Play 服务兼容的模拟器。
推荐阅读
- bitbucket - Bitbucket API:在 webhook 有效负载中获取工作区对象
- javascript - 发出错误报告命令,但不断收到“类型错误:client.fetchUser 不是函数” Discord.js
- python - 将 json.loads 应用于具有 dask 的数据框列
- css - CSS - 将鼠标悬停在具有较小文本的链接上时,导航容器会拉伸
- java - .StaleElementReferenceException 即使添加了断言
- amazon-web-services - 镜像推送到 ECR 时如何部署到 ECS?
- c++ - C++多态模板类,模板类型对象的实例化
- c# - 在 C# 中获取第一个图像结果的 url
- java - 使用 gradle 6.3、OpenJDK 14 和 OpenJFX 14 部署 JavaFX 应用程序
- apache-kafka - 使用 Debezium 提取密钥的转换中不存在字段