2

我真是太绝望了,从 2 天开始就完全卡住了,只需在我的项目中添加 2 个项目并使用控制台编译一个 android 调试版本。

我使用 LibGDX gradle 设置项目,一切正常,直到我将 2 个项目添加到工作区并将它们用作库:-BaseGameUtils -google-play-service

在 Eclipse 中设置它们也可以正常工作,但是使用控制台编译 androidDebug.apk 会出现此错误:错误:com.google.example.games.basegameutils.GameHelper 包不存在导入 com.google.example.games.basegameutils。游戏助手;``

我的 build.gradle 看起来像这样

buildscript {
repositories {
    mavenCentral()
    mavenLocal()
    maven { url 'https://github.com/steffenschaefer/gwt-gradle-plugin/raw/maven-repo/' }
}
dependencies {
    classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.4'
    classpath 'com.android.tools.build:gradle:0.10+'
    classpath 'com.github.jtakakura:gradle-robovm-plugin:0.0.8'
}

}

allprojects { 应用插件:“eclipse” 应用插件:“idea”

version = '1.0'
ext {
    appName = 'FlappysSpaceAdventure'
    gdxVersion = '1.0.1'
    roboVMVersion = '0.0.12'
}

repositories {
    mavenLocal()
    mavenCentral()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}

}

项目(“:桌面”){应用插件:“java”

dependencies {
    compile project(":core")
    compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
    compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
}

}

项目(“:android”){应用插件:“android”

configurations { natives }

dependencies {
    compile project(":core")
    compile "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"
    compile "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"



    compile fileTree(dir: '../libs', include: '*.jar')

}

}

项目(“:ios”){应用插件:“java”应用插件:“robovm”

configurations { natives }

dependencies {
    compile project(":core")
    compile "org.robovm:robovm-rt:${roboVMVersion}"
    compile "org.robovm:robovm-cocoatouch:${roboVMVersion}"
    compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
    natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
    natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-ios"
    compile fileTree(dir: '../libs', include: '*.jar')
}

}

项目(“:html”){应用插件:“gwt”应用插件:“战争”

dependencies {
    compile project(":core")

    compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
    compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
    compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion:sources"
    compile "com.badlogicgames.gdx:gdx-box2d-gwt:$gdxVersion:sources"
}

}

项目(“:核心”){应用插件:“java”

dependencies {

    compile "com.badlogicgames.gdx:gdx:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
    compile "aurelienribon:tweenengine:6.3.3"
    compile "aurelienribon:tweenengine:6.3.3:sources"
}

}

tasks.eclipse.doLast {删除“.project”}

并且类路径文件看起来像这样

<?xml version="1.0" encoding="UTF-8"?>

<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="src" path="/FlappysSpaceAdventure-core"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="con" path="org.springsource.ide.eclipse.gradle.classpathcontainer"/>
<classpathentry combineaccessrules="false" kind="src" path="/BaseGameUtils"/>
<classpathentry combineaccessrules="false" kind="src" path="/google-play-services_lib"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>

我真的不知道该怎么办,我觉得自己很愚蠢……我不明白为什么会这样。

4

0 回答 0