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

View File

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

View File

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