fix: vtm-android-gdx build

This commit is contained in:
Hannes Janetzek 2014-03-22 20:21:11 +01:00
parent fed257a1f7
commit af823f74c7
4 changed files with 60 additions and 54 deletions

View File

@ -1 +0,0 @@
../vtm/assets

View File

@ -13,23 +13,27 @@ repositories {
apply plugin: 'android'
configurations { providedCompile }
dependencies {
compile project(':vtm-gdx')
compile project(':vtm-themes')
compile 'com.noveogroup.android:android-logger:1.3.1'
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"
//compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
//compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
compile files("${rootDir}/vtm-ext-libs/gdx-native-libs.jar")
compile files("${rootDir}/vtm-ext-libs/native-libs.jar")
}
// task copyLibs(type: Copy) {
//task copyLibs(type: Copy) {
// from "$rootDir/vtm-ext-libs/vtm-gdx-android"
// into "libs"
// include '**/*'
// }
//}
// tasks.withType(JavaCompile) { compileTask ->
// compileTask.dependsOn copyAssets }
//tasks.withType(JavaCompile) { compileTask ->
// compileTask.dependsOn copyLibs }
android {
compileSdkVersion 19
@ -52,56 +56,60 @@ android {
}
// Including configurations into Eclipse
eclipse.classpath.plusConfigurations += configurations.compile
eclipse.jdt{
eclipse {
jdt {
sourceCompatibility = 1.6
targetCompatibility = 1.6
}
}
// Configuring Eclipse classpath
classpath {
plusConfigurations += configurations.compile
// Configuring Eclipse classpath
eclipse.classpath {
//customizing the classes output directory:
defaultOutputDir = file('bin/classes')
file {
// only used to explode jni .so into aar
whenMerged { classpath ->
classpath.entries.findAll { entry ->
entry.path.contains('native-libs') }*.exported = false
// Manipulation of the classpath XML before merging local
// and generated copies
beforeMerged { classpath ->
// Remove all source entries to avoid overlap
classpath.entries.removeAll() { c ->
c.kind == 'src'
}
classpath.entries.removeAll { entry ->
entry.path.contains('gdx-1.0-SNAPSHOT') }
}
// Direct manipulation of the generated classpath XML
withXml {
// Since non-default source directories are used
// they need to be manually added to the classpath XML
def node = it.asNode()
// Main source directory
node.appendNode('classpathentry kind="src" path="src"')
// Generated code directory
node.appendNode('classpathentry kind="src" path="gen"')
}
}
}
}
eclipse.project {
project {
natures = ['com.android.ide.eclipse.adt.AndroidNature',
'org.eclipse.jdt.core.javanature']
buildCommand 'com.android.ide.eclipse.adt.ResourceManagerBuilder'
buildCommand 'com.android.ide.eclipse.adt.PreCompilerBuilder'
buildCommand 'com.android.ide.eclipse.adt.ApkBuilder'
linkedResource name: 'assets', type: '2',
locationUri: 'PARENT-1-PROJECT_LOC/vtm/assets'
// use extracted jni .so in eclipse
linkedResource name: 'libs', type: '2',
locationUri: 'PARENT-1-PROJECT_LOC/vtm-ext-libs/vtm-gdx-android'
}
}
task run (dependsOn: 'installDebug'){
doFirst {
println(">> adb run...")
String adb = System.getenv()['ANDROID_HOME'] + '/platform-tools/adb'
String cmd = "${adb} shell am start -n org.oscim.gdx/.MainActivity"
def proc = cmd.execute()
proc.in.eachLine {line -> println line}
proc.err.eachLine {line -> System.err.println( 'ERROR: ' + line)}
proc.waitFor()
}
}

View File

@ -0,0 +1 @@
root=DEBUG:%logger

View File

@ -40,13 +40,11 @@ public class MainActivity extends AndroidApplication {
super.onCreate(savedInstanceState);
AndroidGraphics.init();
GdxAssets.init("");
GLAdapter.init(new AndroidGLAdapter());
// TODO make this dpi dependent
Tile.SIZE = 400;
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
//cfg.useGL20 = true;
new SharedLibraryLoader().load("vtm-jni");