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,12 +13,16 @@ 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")
} }
@ -29,7 +33,7 @@ dependencies {
//} //}
//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 {
eclipse.jdt{
sourceCompatibility = 1.6 sourceCompatibility = 1.6
targetCompatibility = 1.6 targetCompatibility = 1.6
} }
// Configuring Eclipse classpath // Configuring Eclipse classpath
eclipse.classpath { classpath {
//customizing the classes output directory: plusConfigurations += configurations.compile
defaultOutputDir = file('bin/classes') 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 // Direct manipulation of the generated classpath XML
withXml { withXml {
// Since non-default source directories are used
// they need to be manually added to the classpath XML
def node = it.asNode() def node = it.asNode()
// Main source directory
node.appendNode('classpathentry kind="src" path="src"') node.appendNode('classpathentry kind="src" path="src"')
// Generated code directory
node.appendNode('classpathentry kind="src" path="gen"') node.appendNode('classpathentry kind="src" path="gen"')
} }
} }
} }
eclipse.project { project {
natures = ['com.android.ide.eclipse.adt.AndroidNature', natures = ['com.android.ide.eclipse.adt.AndroidNature',
'org.eclipse.jdt.core.javanature'] 'org.eclipse.jdt.core.javanature']
buildCommand 'com.android.ide.eclipse.adt.ResourceManagerBuilder' buildCommand 'com.android.ide.eclipse.adt.ResourceManagerBuilder'
buildCommand 'com.android.ide.eclipse.adt.PreCompilerBuilder' buildCommand 'com.android.ide.eclipse.adt.PreCompilerBuilder'
buildCommand 'com.android.ide.eclipse.adt.ApkBuilder' 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 // use extracted jni .so in eclipse
linkedResource name: 'libs', type: '2', linkedResource name: 'libs', type: '2',
locationUri: 'PARENT-1-PROJECT_LOC/vtm-ext-libs/vtm-gdx-android' 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); 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");