我在 Unity 中制作了一个非常简单的移动 F2P 街机游戏在为我无法构建的 facebook、gamesparks、firebase 和 appodeal 添加 SDK 之后,得到“方法引用过多:76221;最大值为 65536”错误。
字段引用过多的解决方案:70613;max is 65536显然是要导出一个 ADT 项目,将其导入 Android Studio 并从那里开始。
我按照这些说明进行构建,在构建我的 Android Studio 项目后,出现了与 facebook SDK 相关的错误,类似于此处:Unity exporting android project with Facebook SDK issue
那里提出的解决方案是将.aar
Unity 项目中的所有文件复制到 Android Studio 项目中,并在 build.gradle 文件中添加引用它们的行,我这样做了。
在完成所有 4 个与 facebook 相关的错误之后,但出现了一个新错误:
错误:多个库的包名称为“android.support.v7.appcompat”
一个建议的解决方案是搜索有问题的文件并在 Windows 资源管理器中将其删除,但在我的 Android Studio 项目文件夹中没有任何具有该名称的文件。我尝试删除.aar
名称中带有 appcompat 的一些文件,但最终恢复到之前的 4 个 facebook 错误
看来我可以有 4 个 facebook 错误或“多个库”错误。
这是我的 build.gradle 文件的样子..
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.ARTEFICER.fruitfall"
minSdkVersion 16
targetSdkVersion 25
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile(name: 'animated-vector-drawable-23.4.0', ext: 'aar')
compile(name: 'appcompat-v7-23.4.0', ext: 'aar')
compile(name: 'cardview-v7-23.4.0', ext: 'aar')
compile(name: 'customtabs-23.4.0', ext: 'aar')
compile(name: 'facebook-android-sdk-4.17.0', ext: 'aar')
compile(name: 'facebook-android-wrapper-7.9.4', ext: 'aar')
compile(name: 'firebase-app-unity-3.0.3', ext: 'aar')
compile(name: 'firebase-common-10.2.6', ext: 'aar')
compile(name: 'firebase-iid-10.2.6', ext: 'aar')
compile(name: 'firebase-messaging-10.2.6', ext: 'aar')
compile(name: 'firebase-messaging-unity-3.0.3', ext: 'aar')
compile(name: 'play-services-ads-10.2.6', ext: 'aar')
compile(name: 'play-services-ads-lite-10.2.6', ext: 'aar')
compile(name: 'play-services-base-10.2.6', ext: 'aar')
compile(name: 'play-services-basement-10.2.6', ext: 'aar')
compile(name: 'play-services-clearcut-10.2.6', ext: 'aar')
compile(name: 'play-services-gass-10.2.6', ext: 'aar')
compile(name: 'play-services-location-10.2.6', ext: 'aar')
compile(name: 'play-services-tasks-10.2.6', ext: 'aar')
compile(name: 'support-compat-25.2.0', ext: 'aar')
compile(name: 'support-core-ui-25.2.0', ext: 'aar')
compile(name: 'support-core-utils-25.2.0', ext: 'aar')
compile(name: 'support-fragment-25.2.0', ext: 'aar')
compile(name: 'support-media-compat-25.2.0', ext: 'aar')
compile(name: 'support-v4-25.2.0', ext: 'aar')
compile(name: 'support-vector-drawable-23.4.0', ext: 'aar')
compile project(':animatedvectordrawable2340')
compile project(':cardviewv72340')
compile project(':cheetahmobile')
compile project(':customtabs2340')
compile project(':facebookandroidsdk4170')
compile project(':facebookandroidwrapper794')
compile project(':firebase')
compile project(':firebaseappunity303')
compile project(':firebasecommon1026')
compile project(':firebaseiid1026')
compile project(':firebasemessaging1026')
compile project(':firebasemessagingunity303')
compile project(':playservicesads1026')
compile project(':playservicesadslite1026')
compile project(':playservicesbase1026')
compile project(':playservicesclearcut1026')
compile project(':playservicesgass1026')
compile project(':playserviceslocation1026')
compile project(':playservicestasks1026')
compile project(':supportcompat2520')
compile project(':supportcoreui2520')
compile project(':supportcoreutils2520')
compile project(':supportfragment2520')
compile project(':supportmediacompat2520')
compile project(':supportv42520')
compile project(':supportvectordrawable2340')
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:appcompat-v7:25.3.1'
compile files('libs/applovin-6.3.0.jar')
compile files('libs/appodeal-1.15.9.jar')
compile files('libs/bolts-android-1.4.0.jar')
compile files('libs/bolts-applinks-1.4.0.jar')
compile files('libs/bolts-tasks-1.4.0.jar')
compile files('libs/chartboost-6.6.1.jar')
compile files('libs/flurry-analytics-6.5.0.jar')
compile files('libs/libmessaging_unity_player_activity.jar')
compile files('libs/my-target-4.5.10.jar')
compile files('libs/support-annotations-25.2.0.jar')
compile files('libs/unity-ads-2.0.4.jar')
compile files('libs/unity-classes.jar')
compile files('libs/yandex-metrica-2.62.jar')
}
allprojects {
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
}
我试过注释掉这些行。
compile 'com.android.support:appcompat-v7:25.3.1'
compile project(':supportcompat2520')
compile(name: 'support-compat-25.2.0', ext: 'aar')
但是我仍然有一个“具有包名称的多个库”错误
另请注意,我是 Unity 开发人员。直到几天前我才打开 Android Studio,所以你肯定需要尽可能地简化事情!