首页 > 解决方案 > 程序类型已存在:com.android.installreferrer.api.InstallReferrerClient$1

问题描述

团结 2018.4.15。为 Android 平台构建项目时出现错误:

CommandInvokationFailure:Gradle 构建失败。J:\Program Files\2018.4.15f1\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "J:\Program Files\2018.4.15f1\Editor\Data\PlaybackEngines\AndroidPlayer\工具\gradle\lib\gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

stderr [ D8:程序类型已经存在:com.android.installreferrer.api.InstallReferrerClient$1

FAILURE:构建失败并出现异常。

  • 出了什么问题:任务“:transformDexArchiveWithExternalLibsDexMergerForRelease”执行失败。

Assets/Plugins/Android/ 文件夹中只有一个名为“installreferrer-1.0.aar”的库。我使用 Facebook 插件 (7.18.0)、GoogleMobileAds (4.2.1)、Applovin SDK (9.11.1) 和 Facebook 中介 (5.6.1.0)。

如果我删除了 installreferrer-1.0.aar - 项目编译正常,但它在设备上运行后崩溃。如果我回滚库并删除 Facebook 插件,项目编译正常,但也会崩溃。我认为 FB connect 导致了我的错误,但我无法解决它。

显现:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <application android:theme="@style/UnityThemeSelector" android:icon="@mipmap/app_icon" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_security_config"
               android:name="android.support.multidex.MultiDexApplication" tools:replace="android:icon">
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>
    <activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.facebook.unity.FBUnityAppLinkActivity" android:exported="true" />
    <activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true" />
    <activity android:name="com.facebook.unity.FBUnityGameRequestActivity" />
    <activity android:name="com.facebook.unity.FBUnityCreateGameGroupActivity" />
    <activity android:name="com.facebook.unity.FBUnityJoinGameGroupActivity" />
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb2575328535843348" />
    <meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled" android:value="true" />
    <meta-data android:name="com.facebook.sdk.AdvertiserIDCollectionEnabled" android:value="true" />
    <provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider2575328535843348" android:exported="true" />
    <receiver android:name="com.appsflyer.SingleInstallBroadcastReceiver" android:exported="true">
      <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
      </intent-filter>
    </receiver>
  </application>
  <uses-permission android:name="com.android.vending.BILLING" />
</manifest>

mainTeplate.gradle

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
**BUILD_SCRIPT_DEPS**}
}

allprojects {
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

// Android Resolver Repos Start
([rootProject] + (rootProject.subprojects as List)).each {
    ext {
        it.setProperty("android.useAndroidX", true)
        it.setProperty("android.enableJetifier", true)
    }
}
([rootProject] + (rootProject.subprojects as List)).each { project ->
    project.repositories {
        def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
        maven {
            url "https://maven.google.com"
        }
        maven {
            url "https://maven.google.com/" // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7
        }
        maven {
            url "https://adcolony.bintray.com/AdColony" // Assets/MaxSdk/Mediation/AdColony/Editor/Dependencies.xml:8
        }
        maven {
            url "https://applovin.bintray.com/Android-Adapter-SDKs" // Assets/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml:8, Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
        }
        maven {
            url "https://s3.amazonaws.com/smaato-sdk-releases/" // Assets/MaxSdk/Mediation/Smaato/Editor/Dependencies.xml:8
        }
        mavenLocal()
        jcenter()
        mavenCentral()
    }
}
// Android Resolver Repos End
apply plugin: 'com.android.application'
**APPLY_PLUGINS**

dependencies {
    implementation 'com.android.support:multidex:1.0.1'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
    implementation 'com.android.support:appcompat-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.android.support:appcompat-v7:28.+' // Assets/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml:10
    implementation 'com.android.support:cardview-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.android.support:customtabs:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.android.support:recyclerview-v7:28.+' // Assets/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml:9
    implementation 'com.android.support:support-v4:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    implementation 'com.applovin.mediation:adcolony-adapter:4.1.2.1' // Assets/MaxSdk/Mediation/AdColony/Editor/Dependencies.xml:8
    implementation 'com.applovin.mediation:facebook-adapter:[5.6.1.0]' // Assets/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml:8
    implementation 'com.applovin.mediation:fyber-adapter:7.5.0.0' // Assets/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml:8
    implementation 'com.applovin.mediation:google-adapter:[17.2.1.7]' // Assets/MaxSdk/Mediation/Google/Editor/Dependencies.xml:5
    implementation 'com.applovin.mediation:ironsource-adapter:6.13.0.1.0' // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
    implementation 'com.applovin.mediation:mintegral-adapter:10.1.51.2' // Assets/MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml:4
    implementation 'com.applovin.mediation:smaato-adapter:21.3.1.0' // Assets/MaxSdk/Mediation/Smaato/Editor/Dependencies.xml:8
    implementation 'com.applovin.mediation:tapjoy-adapter:12.4.0.0' // Assets/MaxSdk/Mediation/Tapjoy/Editor/Dependencies.xml:4
    implementation 'com.applovin.mediation:unityads-adapter:3.4.0.1' // Assets/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml:4
    implementation 'com.applovin:applovin-sdk:9.11.1' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:4
    implementation 'com.facebook.android:facebook-applinks:[5,6)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:6
    implementation 'com.facebook.android:facebook-core:[5,6)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:5
    implementation 'com.facebook.android:facebook-login:[5,6)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:7
    implementation 'com.facebook.android:facebook-share:[5,6)' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:8
    implementation 'com.google.android.gms:play-services-ads:18.2.0' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7
    implementation 'com.google.android.gms:play-services-ads-identifier:[16.0.0]' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:5
    implementation 'com.parse.bolts:bolts-android:1.4.0' // Assets/FacebookSDK/Plugins/Editor/Dependencies.xml:4
// Android Resolver Dependencies End
**DEPS**}

// Android Resolver Exclusions Start
android {
  packagingOptions {
      exclude ('/lib/armeabi/*' + '*')
      exclude ('/lib/mips/*' + '*')
      exclude ('/lib/mips64/*' + '*')
      exclude ('/lib/x86/*' + '*')
      exclude ('/lib/x86_64/*' + '*')
  }
}
// Android Resolver Exclusions End
android {
    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        multiDexEnabled true
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
        applicationId '**APPLICATIONID**'
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
    }

    dexOptions {
        javaMaxHeapSize "16g"
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]
    }**SIGN**

    buildTypes {
        debug {
            minifyEnabled **MINIFY_DEBUG**
            useProguard **PROGUARD_DEBUG**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
            jniDebuggable true
        }
        release {
            minifyEnabled **MINIFY_RELEASE**
            useProguard **PROGUARD_RELEASE**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
        }
    }**PACKAGING_OPTIONS****SPLITS**
**BUILT_APK_LOCATION**
    bundle {
        language {
            enableSplit = false
        }
        density {
            enableSplit = false
        }
        abi {
            enableSplit = true
        }
    }
}**SPLITS_VERSION_CODE****REPOSITORIES****SOURCE_BUILD_SETUP**

标签: c#androidunity3dgradleandroid-gradle-plugin

解决方案


将您的 Facebook android 依赖项从“[5,6)”更改为“5.13.0”。这已从文件中包含在您的 mainTemplate.gradle 中 Assets/FacebookSDK/Plugins/Editor/Dependencies.xml


推荐阅读