我正在尝试在我的Android本机应用程序中实现Tips-Stripe。
在为条带(jitpack)添加第二个Maven存储库后:
allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
//Second maven was added per linking instructions on tipsi-stripe docs.
maven { url "https://jitpack.io"}
jcenter()
google()
}
}
我收到以下错误:
D8: Program type already present: com.google.android.gms.internal.zzcce
基于以前有类似问题的帖子,似乎这与firebase的版本差异有关(我假设jitpack根据提出的解决方案使用这些依赖项)。
我观看了构建,并下载了以下Firebase库:
为了通过提供正确的版本来解决该问题,我添加了相应的firebase实现:
android / app / build.gradle:
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.testforce.android"
multiDexEnabled true
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
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]
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 {
compile project(':react-native-vector-icons')
implementation project(':tipsi-stripe')
implementation project(':react-native-vector-icons')
implementation(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.google.android.gms:play-services-base:12.0.1'
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'com.android.support:appcompat-v7:23.0.0'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-analytics:16.0.3'
implementation "com.facebook.react:react-native:+"
api project(':libs:SalesforceReact') // From node_modules
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
该应用程序现在可以成功构建,但是在模拟器上启动后,该应用程序将停止运行并关闭。
答案 0 :(得分:0)
升级play-services-maps
implementation 'com.google.android.gms:play-services-maps:15.0.1'