我非常绝望,并且自从2天以来完全陷入困境,只需在我的项目中添加2个项目并使用控制台编译Android Debuging版本。
我使用LibGDX gradle设置项目,一切正常,直到我将2个项目添加到工作区并将它们用作图书馆: -BaseGameUtils -Google播放服务
在eclipse中设置它们也很好,但是用控制台编译androidDebug.apk会出现这个错误: 错误:包com.google.example.games.basegameutils.GameHelper不存在 import com.google.example.games.basegameutils.GameHelper; '`
我的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” 申请插件:“想法”
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/" }
}
}
project(“:desktop”){ apply plugin:“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"
}
}
project(“:android”){ apply plugin:“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')
}
}
project(“:ios”){ apply plugin:“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')
}
}
project(“:html”){ apply plugin:“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"
}
}
project(“:core”){ apply plugin:“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"/>
我真的不知道该怎么做,我觉得很蠢......我不明白为什么会这样。