我几天来一直在努力解决这个问题,而且我似乎无法找到解决问题的方法,这是完整的错误:
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
allprojects {
repositories {
flatDir {
dirs 'libs'
}
}
}
apply plugin: 'com.android.application'
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile(name: 'android.arch.core.runtime-1.1.0', ext:'aar')
compile(name: 'android.arch.lifecycle.livedata-core-1.1.0', ext:'aar')
compile(name: 'android.arch.lifecycle.runtime-1.1.0', ext:'aar')
compile(name: 'android.arch.lifecycle.viewmodel-1.1.0', ext:'aar')
compile(name: 'cardview-v7-25.3.1', ext:'aar')
compile(name: 'com.android.support.animated-vector-drawable-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.appcompat-v7-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.asynclayoutinflater-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.cardview-v7-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.coordinatorlayout-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.cursoradapter-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.customtabs-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.customview-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.documentfile-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.drawerlayout-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.interpolator-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.loader-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.localbroadcastmanager-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.percent-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.print-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.recyclerview-v7-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.slidingpanelayout-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.support-compat-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.support-core-ui-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.support-core-utils-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.support-fragment-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.support-media-compat-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.support-v4-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.support-vector-drawable-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.swiperefreshlayout-28.0.0-alpha1', ext:'aar')
compile(name: 'com.android.support.viewpager-28.0.0-alpha1', ext:'aar')
compile(name: 'com.github.vungle.vungle-android-sdk-5.3.0', ext:'aar')
compile(name: 'com.google.ads.mediation.unity-2.1.2.0', ext:'aar')
compile(name: 'com.google.ads.mediation.vungle-5.3.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-ads-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-ads-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-ads-lite-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-ads-lite-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-base-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-base-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-basement-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-basement-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-gass-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-gass-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-gcm-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-gcm-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-iid-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-iid-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-location-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-location-license-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-tasks-11.8.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-tasks-license-11.8.0', ext:'aar')
compile(name: 'com.sglib.easymobile.easy-mobile-1.0.2', ext:'aar')
compile(name: 'com.unity3d.ads.unity-ads-2.1.2', ext:'aar')
compile(name: 'common', ext:'aar')
compile(name: 'constraint-layout-1.0.2', ext:'aar')
compile(name: 'GoogleAIDL', ext:'aar')
compile(name: 'GooglePlay', ext:'aar')
compile(name: 'onesignal-unity', ext:'aar')
compile(name: 'percent-25.3.1', ext:'aar')
compile(name: 'unity-ads', ext:'aar')
compile project(':answers')
compile project(':beta')
compile project(':crashlytics')
compile project(':crashlytics-wrapper')
compile project(':fabric')
compile project(':fabric-init')
compile project(':GoogleMobileAdsPlugin')
compile project(':OneSignalConfig')
}
android {
compileSdkVersion 21
buildToolsVersion '28.0.0'
defaultConfig {
multiDexEnabled true
targetSdkVersion 21
applicationId 'com.chorusworldwide.upjump'
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress '.unity3d', '.ress', '.resource', '.obb'
}
buildTypes {
debug {
minifyEnabled false
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
jniDebuggable true
}
release {
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
}
}
}
这是我的gradle.build内容:
CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk1.8.0_131\bin\java.exe -classpath "C:\Program Files\Unity2017.2\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-2.14.jar" org.gradle.launcher.GradleMain "assembleDebug"
stderr[
C:\Projects\UpJump\Temp\gradleOut\build\intermediates\exploded-aar\com.android.support.appcompat-v7-28.0.0-alpha1\res\values-v28\values-v28.xml:5:5-8:13: AAPT: No resource found that matches the given name (at 'dialogCornerRadius' with value '?android:attr/dialogCornerRadius').
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\DevTools\New_SDK\build-tools\27.0.0\aapt.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
]
出于某种原因,它会不断地将buildToolsVersion覆盖到"' 28.0.0'"即使我特意将构建设置设置为:
我还将自己的gradle.build文件添加到Plugin / Android,这是同一个文件,但是将不同的BuildToolsVersion设置为27.0.0,但是,位于项目内Temp文件夹中的build.gradle文件仍在重置到" 28",
我还将自己的gradle.build文件添加到Plugin / Android,这是同一个文件,但是将不同的BuildToolsVersion设置为27.0.0,但是,位于项目内Temp文件夹中的build.gradle文件仍在重置至" 28", 最后是我的SDK管理器的一些截图:
Android(P)的部分安装是因为这个(我不必安装所有这些都不是吗?):
SDK工具:
从构建工具中删除28.0.0-rc1后,更新:,build.gradle以版本27开始构建,但现在出现了新错误:
{!loading && (ad.status !== 'active' && ad.status !== 'paid') && <div>
display something base on not active and not paid
</div>}
{!loading && ad.status === 'paid' && <div>display content base on paid</div>}
{!loading && ad.status === 'active' && <div>display content base on active</div>}
答案 0 :(得分:4)
AWrightIV's answer让我大部分都在那里。但对我来说解决方案并不复杂。我生成了一个mainTemplate.gradle文件,当您在播放器设置中打开“使用自定义gradle文件”并更改buildToolsVersion行时,它会创建统一。
Assets / Plugins / Android / mainTemplate.gradle中的原始行:
buildToolsVersion '**BUILDTOOLS**'
新:
buildToolsVersion '27'
答案 1 :(得分:3)
解决了!
我的主要问题是:
查看所有这些28.0.0-alpha文件,问题因为这些而开始发生,我100%肯定它,因为当我回滚(谢天谢地使用版本控制)时,主要区别之一是这些库不是在那里,我删除了它们,但由于“播放服务解析器”它们不断回来,所以我认为它与我安装在我的Android SDK中的任何版本无关,它与其中一个版本100%相关插件。
我创建了一个新项目,导入了针对Unity的GoogleAdsMediation(这是最重要的插件)并执行了“解决”功能,并且根本没有“28”文件,因此它不是谷歌插件,我一直在做我们拥有所有插件。 导入 - &gt;删除所有库 - &gt;力量解决。 直到我找到了罪魁祸首,它是OneSignal,他们的依赖配置(或其他东西)迫使解析器导入这些“28.0.0-alpha”库,我删除了那个版本的OneSignal,导入了旧版本(从旧版本的我们的项目)和轰!问题解决了:)
我希望这会有所帮助。
喝彩!
答案 2 :(得分:1)
@SawThinkarNayHtoo提到的类似问题的答案将帮助你完成大部分工作。这里再次链接:Importing Vufoira Scene into native android app
它的主旨是您希望在定位Android时导出Unity项目。其他地方有很好的教程如何做到这一点,但这里是上面答案的链接: Export Unity Project to Android Studio
按照上述步骤后,我还需要再做一步:
如有必要,您还可以编辑文件而不导出。在文件系统中搜索项目目录,以获取&#34; buildToolsVersion&#34;。你应该找到build.gradle文件。编辑上述内容。
答案 3 :(得分:0)
我遇到了同样的问题,直到我下载了最新的29个sdk构建工具之前,我还可以。我从SDK中删除了构建工具,这解决了我的问题