当前位置: 首页 > 知识库问答 >
问题:

程序类型已经存在:com.android.installreferrer.api.InstallReferrerClient1美元

孟浩然
2023-03-14

Unity 2018.4.15。为Android平台构建项目时出错:

CommandInvokationFailure: Gradle build失败。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\Tools\gradle\lib\gradle-launcher-5.1.1.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx4096m” “assembleRelease”

stderr[D8:程序类型已存在:com.android.installreferrer.api.InstallReferrerClient1美元

失败:生成失败,出现异常。

  • 出了什么问题:任务执行失败': TransformDexArchive的外部alLibsDexMergerForRelance'。

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 - 项目编译正常,但在设备上运行后崩溃。如果我回滚库

舱单:

<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**

共有2个答案

翁钧
2023-03-14

解决问题:

  1. 从项目和清单中删除FB插件,FB中介
  2. 退出统一
  3. 删除库文件
  4. 启动 Unity 并在没有 FB 的情况下编译!
  5. 安装 FB
  6. 将您的 Facebook Android依赖项从“[5,6)”更改为“5.13.0”
  7. 资产-
路伟
2023-03-14

将您的Facebook android依赖项从“[5,6)”更改为“5.13.0”。这包含在您的mainTemplate.gradle中,来自文件资产/Facebook SDK/插件/编辑器/Dependencies.xml

 类似资料: