我已经使用Android Studio和框架libgdx成功构建了适用于android的apt。我现在正在尝试对iOS版本执行相同操作。
但是,当尝试使用robovm编译iOS版本时,出现以下错误:
[INFO] 13:03:17.478 classpath entry: /Users/<username>/.gradle/caches/modules-2/files-2.1/com.google.android.gms/play-services-tasks/17.0.0/18299a334d48bc5abfe3c9446c2a9e1a3b3f38e1/play-services-tasks-17.0.0.aar
[INFO] 13:03:17.478 Using SDK boot classpath
[ERROR] Couldn't compile app
java.io.IOException: File is not an archive file: /Users/<username>/.gradle/caches/modules-2/files-2.1/androidx.legacy/legacy-support-core-ui/1.0.0/61a264f996046e059f889914050fae1e75d3b702/legacy-support-core-ui-1.0.0.aar
at org.robovm.compiler.clazz.Clazzes.addPaths(Clazzes.java:85)
at org.robovm.compiler.clazz.Clazzes.<init>(Clazzes.java:55)
at org.robovm.compiler.config.Config.build(Config.java:997)
at org.robovm.compiler.config.Config.access$5400(Config.java:110)
at org.robovm.compiler.config.Config$Builder.build(Config.java:1632)
at org.robovm.idea.compilation.RoboVmCompileTask.compileForRunConfiguration(RoboVmCompileTask.java:290)
at org.robovm.idea.running.RoboVmBeforeRunTaskProvider$1.run(RoboVmBeforeRunTaskProvider.java:97)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:888)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:163)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:585)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:531)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:150)
at com.intellij.openapi.progress.impl.CoreProgressManager$4.lambda$run$0(CoreProgressManager.java:402)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:221)
at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:402)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:238)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
这是我的项目的build.gradle:
buildscript {
ext {
//https://libgdx.badlogicgames.com/libgdx-site/service/getVersions?release=false
gdxVersion = '1.9.10'
roboVMVersion = '2.3.10-SNAPSHOT'
roboVMGradleVersion = '2.3.10-SNAPSHOT'
androidToolsVersion = '28.0.3'
androidSDKVersion = '28'
androidGradleToolsVersion = '3.4.2'
gwtVersion = '2.8.2'
gwtGradleVersion = '1.0.9'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
gdxPayVersion = '0.11.4'
googleSrvVersion = '3.2.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
google()
}
dependencies {
classpath "org.wisepersist:gwt-gradle-plugin:$gwtGradleVersion"
classpath "com.android.tools.build:gradle:$androidGradleToolsVersion"
classpath "com.mobidevelop.robovm:robovm-gradle-plugin:$roboVMGradleVersion"
classpath "com.google.gms:google-services:$googleSrvVersion"
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "MonBots RPG"
}
repositories {
mavenLocal()
mavenCentral()
google()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
maven { url "https://jcenter.bintray.com" } //add this line
maven { url "https://adcolony.bintray.com/AdColony"}
}
}
project(":desktop") {
apply plugin: "java"
dependencies {
implementation project(":core")
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
implementation project(":core")
implementation 'com.android.support:multidex:1.0.3'
implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
implementation "com.google.android.gms:play-services-games:18.0.0"
implementation "com.google.android.gms:play-services-ads:19.1.0"
implementation "com.badlogicgames.gdxpay:gdx-pay-android-googlebilling:$gdxPayVersion"
// For @Nullable/@NonNull
implementation 'com.android.support:support-annotations:23.1.1'
implementation 'com.google.ads.mediation:adcolony:4.1.4.1'
implementation 'com.google.ads.mediation:unity:3.4.2.3'
implementation 'com.google.ads.mediation:tapjoy:12.4.2.0'
}
}
project(":ios") {
apply plugin: "java"
apply plugin: "robovm"
dependencies {
implementation project(":core")
implementation "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
implementation "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
implementation "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-ios"
implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
implementation "com.badlogicgames.gdxpay:gdx-pay-iosrobovm-apple:$gdxPayVersion"
implementation 'com.google.ads.mediation:adcolony:4.1.4.1'
implementation 'com.google.ads.mediation:unity:3.4.2.3'
implementation 'com.google.ads.mediation:tapjoy:12.4.2.0'
}
}
project(":core") {
apply plugin: "java"
dependencies {
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
implementation "com.esotericsoftware.spine:spine-libgdx:3.7.0.1"
implementation "com.badlogicgames.gdxpay:gdx-pay-client:$gdxPayVersion"
implementation 'com.esotericsoftware:kryonet:2.22.0-RC1'
}
}
tasks.eclipse.doLast {
delete ".project"
}
这是iOS模块的build.gradle
sourceSets.main.java.srcDirs = [ "src/" ]
sourceCompatibility = '1.7'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
ext {
mainClassName = "com.monbots.IOSLauncher"
}
launchIPhoneSimulator.dependsOn build
launchIPadSimulator.dependsOn build
launchIOSDevice.dependsOn build
createIPA.dependsOn build
eclipse.project {
name = appName + "-ios"
natures 'org.robovm.eclipse.RoboVMNature'
}
我试图在Google上找到类似的问题,但没有任何运气。您知道如何解决此问题吗?
提前谢谢您,
马特
哦,我发现了,我在iOS广告中放置了错误的实现:
implementation 'com.google.ads.mediation:adcolony:4.1.4.1'
implementation 'com.google.ads.mediation:unity:3.4.2.3'
implementation 'com.google.ads.mediation:tapjoy:12.4.2.0'
我必须为此使用独脚架。