代码之家  ›  专栏  ›  技术社区  ›  S.B.

程序类型已存在-Tipsi条带

  •  -1
  • S.B.  · 技术社区  · 7 年前

    我正在尝试在我的react原生android应用程序中实现tipsi条带。

    在为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基于提出的解决方案使用这些依赖关系)。

    enter image description here

    为了通过提供正确的版本来解决这个问题,我添加了相应的firebase实现:

    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'
    }
    

    应用程序现在成功构建,但在模拟器上启动时,应用程序停止工作并关闭。

    1 回复  |  直到 7 年前
        1
  •  0
  •   S.B.    7 年前

    升级play services地图:

    implementation 'com.google.android.gms:play-services-maps:15.0.1'