Not able to run libgdx android sample in android studio -
i have followed instructions in libgdx setup , generated 'test' directory contains android sample project . have imported ( contains 2 directory 'android' , 'core' ) not able run it. every time error comes while compiling gradle :
android { buildtoolsversion "21.1.2" compilesdkversion 22 sourcesets { main { manifest.srcfile 'androidmanifest.xml' java.srcdirs = ['src'] aidl.srcdirs = ['src'] renderscript.srcdirs = ['src'] res.srcdirs = ['res'] assets.srcdirs = ['assets'] } instrumenttest.setroot('tests') } } // needed add jni shared libraries apk when compiling on cli tasks.withtype(com.android.build.gradle.tasks.packageapplication) { pkgtask -> pkgtask.jnifolders = new hashset<file>() pkgtask.jnifolders.add(new file(projectdir, 'libs')) } // called every time gradle gets executed, takes native dependencies of // natives configuration, , extracts them proper libs/ folders // packed apk. task copyandroidnatives() { file("libs/armeabi/").mkdirs(); file("libs/armeabi-v7a/").mkdirs(); file("libs/x86/").mkdirs(); configurations.natives.files.each { jar -> def outputdir = null if(jar.name.endswith("natives-armeabi-v7a.jar")) outputdir = file("libs/armeabi-v7a") if(jar.name.endswith("natives-armeabi.jar")) outputdir = file("libs/armeabi") if(jar.name.endswith("natives-x86.jar")) outputdir = file("libs/x86") if(outputdir != null) { copy { ziptree(jar) outputdir include "*.so" } } } } task run(type: exec) { def path def localproperties = project.file("../local.properties") if (localproperties.exists()) { properties properties = new properties() localproperties.withinputstream { instr -> properties.load(instr) } def sdkdir = properties.getproperty('sdk.dir') if (sdkdir) { path = sdkdir } else { path = "$system.env.android_home" } } else { path = "$system.env.android_home" } def adb = path + "/platform-tools/adb" commandline "$adb", 'shell', 'am', 'start', '-n', 'com.mygdx.game.android/com.mygdx.game.android.androidlauncher' } // sets android eclipse project, using old ant based build. eclipse { // need specify java source sets explicitely, springsource gradle eclipse plugin // ignores nodes added in classpath.file.withxml sourcesets { main { java.srcdirs "src", 'gen' } } jdt { sourcecompatibility = 1.6 targetcompatibility = 1.6 } classpath { plusconfigurations += [ project.configurations.compile ] containers 'com.android.ide.eclipse.adt.android_framework', 'com.android.ide.eclipse.adt.libraries' } project { name = appname + "-android" natures 'com.android.ide.eclipse.adt.androidnature' buildcommands.clear(); buildcommand "com.android.ide.eclipse.adt.resourcemanagerbuilder" buildcommand "com.android.ide.eclipse.adt.precompilerbuilder" buildcommand "org.eclipse.jdt.core.javabuilder" buildcommand "com.android.ide.eclipse.adt.apkbuilder" } } // sets android idea project, using old ant based build. idea { module { sourcedirs += file("src"); scopes = [ compile: [plus:[project.configurations.compile]]] iml { withxml { def node = it.asnode() def builder = nodebuilder.newinstance(); builder.current = node; builder.component(name: "facetmanager") { facet(type: "android", name: "android") { configuration { option(name: "update_property_files", value:"true") } } } } } } }
after add in
apply plugin: 'com.android.application'
then error:
my build.gradle of core :
apply plugin: "java" sourcecompatibility = 1.6 [compilejava, compiletestjava]*.options*.encoding = 'utf-8' sourcesets.main.java.srcdirs = [ "src/" ] eclipse.project { name = appname + "-core" }
also in core's build.gradle error in :
eclipse not found :
eclipse.project { name = appname + "-core" }
well worked , imported test in new project instead of merging modules in existing project . , used default gradle wrapper instead of local gradle distribution .
Comments
Post a Comment