我准备在Windows10上开发一个libGDXAndroid应用程序,最新的EclipseMars。2、最新Android SDK和最新版本的libGDX。我将按照此处的设置说明进行操作:项目设置Gradle
在这里:
设置开发环境(Eclipse、Intellij IDEA、NetBeans)
这里呢
渐变与日食
我当我运行我的Android应用程序它崩溃与输出在logcat:
04-09 02:01:56.357: E/Trace(20747): error opening trace file: No such file or directory (2)
04-09 02:01:56.367: D/ActivityThread(20747): setTargetHeapUtilization:0.25
04-09 02:01:56.367: D/ActivityThread(20747): setTargetHeapIdealFree:8388608
04-09 02:01:56.367: D/ActivityThread(20747): setTargetHeapConcurrentStart:2097152
04-09 02:01:56.548: W/dalvikvm(20747): Unable to resolve superclass of Lcom/mygdx/game/AndroidLauncher; (3)
04-09 02:01:56.548: W/dalvikvm(20747): Link of class 'Lcom/mygdx/game/AndroidLauncher;' failed
04-09 02:01:56.548: W/dalvikvm(20747): threadid=1: thread exiting with uncaught exception (group=0x41367438)
04-09 02:01:56.568: E/AndroidRuntime(20747): FATAL EXCEPTION: main
04-09 02:01:56.568: E/AndroidRuntime(20747): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mygdx.game/com.mygdx.game.AndroidLauncher}: java.lang.ClassNotFoundException: com.mygdx.game.AndroidLauncher
04-09 02:01:56.568: E/AndroidRuntime(20747): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2005)
04-09 02:01:56.568: E/AndroidRuntime(20747): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2106)
04-09 02:01:56.568: E/AndroidRuntime(20747): at android.app.ActivityThread.access$600(ActivityThread.java:138)
04-09 02:01:56.568: E/AndroidRuntime(20747): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1204)
04-09 02:01:56.568: E/AndroidRuntime(20747): at android.os.Handler.dispatchMessage(Handler.java:99)
04-09 02:01:56.568: E/AndroidRuntime(20747): at android.os.Looper.loop(Looper.java:137)
04-09 02:01:56.568: E/AndroidRuntime(20747): at android.app.ActivityThread.main(ActivityThread.java:4921)
04-09 02:01:56.568: E/AndroidRuntime(20747): at java.lang.reflect.Method.invokeNative(Native Method)
04-09 02:01:56.568: E/AndroidRuntime(20747): at java.lang.reflect.Method.invoke(Method.java:511)
04-09 02:01:56.568: E/AndroidRuntime(20747): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
04-09 02:01:56.568: E/AndroidRuntime(20747): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
04-09 02:01:56.568: E/AndroidRuntime(20747): at dalvik.system.NativeStart.main(Native Method)
04-09 02:01:56.568: E/AndroidRuntime(20747): Caused by: java.lang.ClassNotFoundException: com.mygdx.game.AndroidLauncher
04-09 02:01:56.568: E/AndroidRuntime(20747): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
04-09 02:01:56.568: E/AndroidRuntime(20747): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
04-09 02:01:56.568: E/AndroidRuntime(20747): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
04-09 02:01:56.568: E/AndroidRuntime(20747): at android.app.Instrumentation.newActivity(Instrumentation.java:1056)
04-09 02:01:56.568: E/AndroidRuntime(20747): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1996)
04-09 02:01:56.568: E/AndroidRuntime(20747): ... 11 more
知道我做错了什么吗?
这是我的android代码,它没有改变,由libGDX安装过程生成。
package com.mygdx.game;
import android.os.Bundle;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.mygdx.game.MyGdxGame;
public class AndroidLauncher extends AndroidApplication {
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
initialize(new MyGdxGame(), config);
}
}
这是我的AndroidManifest。xml(再次被be完全更改)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mygdx.game"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="23" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/GdxTheme" >
<activity
android:name="com.mygdx.game.AndroidLauncher"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
这里是Android目录中的gradle.build,也由我不变。
android {
buildToolsVersion "23.0.3"
compileSdkVersion 23
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
instrumentTest.setRoot('tests')
}
defaultConfig {
applicationId "com.mygdx.game"
minSdkVersion 8
targetSdkVersion 23
}
}
// called every time gradle gets executed, takes the native dependencies of
// the natives configuration, and extracts them to the proper libs/ folders
// so they get packed with the APK.
task copyAndroidNatives() {
file("libs/armeabi/").mkdirs();
file("libs/armeabi-v7a/").mkdirs();
file("libs/arm64-v8a/").mkdirs();
file("libs/x86_64/").mkdirs();
file("libs/x86/").mkdirs();
configurations.natives.files.each { jar ->
def outputDir = null
if(jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
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_64.jar")) outputDir = file("libs/x86_64")
if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
if(outputDir != null) {
copy {
from zipTree(jar)
into 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/com.mygdx.game.AndroidLauncher'
}
// sets up the Android Eclipse project, using the old Ant based build.
eclipse {
// need to specify Java source sets explicitly, SpringSource Gradle Eclipse plugin
// ignores any 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 up the Android Idea project, using the 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")
}
}
}
}
}
}
}
如果我尝试在调试器中运行应用程序,我会在尝试并跨过第一条指令后立即在logcat中获得以下信息:
04-09 19:23:54.285: D/AndroidRuntime(2419): Shutting down VM
04-09 19:23:54.286: E/AndroidRuntime(2419): FATAL EXCEPTION: main
04-09 19:23:54.286: E/AndroidRuntime(2419): Process: com.mygdx.game, PID: 2419
04-09 19:23:54.286: E/AndroidRuntime(2419): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mygdx.game/com.mygdx.game.AndroidLauncher}: java.lang.ClassNotFoundException: Didn't find class "com.mygdx.game.AndroidLauncher" on path: DexPathList[[zip file "/data/app/com.mygdx.game-1/base.apk"],nativeLibraryDirectories=[/data/app/com.mygdx.game-1/lib/x86_64, /data/app/com.mygdx.game-1/base.apk!/lib/x86_64, /vendor/lib64, /system/lib64]]
04-09 19:23:54.286: E/AndroidRuntime(2419): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
04-09 19:23:54.286: E/AndroidRuntime(2419): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
04-09 19:23:54.286: E/AndroidRuntime(2419): at android.app.ActivityThread.-wrap11(ActivityThread.java)
04-09 19:23:54.286: E/AndroidRuntime(2419): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
04-09 19:23:54.286: E/AndroidRuntime(2419): at android.os.Handler.dispatchMessage(Handler.java:102)
04-09 19:23:54.286: E/AndroidRuntime(2419): at android.os.Looper.loop(Looper.java:148)
04-09 19:23:54.286: E/AndroidRuntime(2419): at android.app.ActivityThread.main(ActivityThread.java:5417)
04-09 19:23:54.286: E/AndroidRuntime(2419): at java.lang.reflect.Method.invoke(Native Method)
04-09 19:23:54.286: E/AndroidRuntime(2419): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
04-09 19:23:54.286: E/AndroidRuntime(2419): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
04-09 19:23:54.286: E/AndroidRuntime(2419): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mygdx.game.AndroidLauncher" on path: DexPathList[[zip file "/data/app/com.mygdx.game-1/base.apk"],nativeLibraryDirectories=[/data/app/com.mygdx.game-1/lib/x86_64, /data/app/com.mygdx.game-1/base.apk!/lib/x86_64, /vendor/lib64, /system/lib64]]
04-09 19:23:54.286: E/AndroidRuntime(2419): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
04-09 19:23:54.286: E/AndroidRuntime(2419): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-09 19:23:54.286: E/AndroidRuntime(2419): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
04-09 19:23:54.286: E/AndroidRuntime(2419): at android.app.Instrumentation.newActivity(Instrumentation.java:1067)
04-09 19:23:54.286: E/AndroidRuntime(2419): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)
04-09 19:23:54.286: E/AndroidRuntime(2419): ... 9 more
04-09 19:23:54.286: E/AndroidRuntime(2419): Suppressed: java.lang.NoClassDefFoundError: com.mygdx.game.AndroidLauncher
04-09 19:23:54.286: E/AndroidRuntime(2419): at dalvik.system.DexFile.defineClassNative(Native Method)
04-09 19:23:54.286: E/AndroidRuntime(2419): at dalvik.system.DexFile.defineClass(DexFile.java:226)
04-09 19:23:54.286: E/AndroidRuntime(2419): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
04-09 19:23:54.286: E/AndroidRuntime(2419): at dalvik.system.DexPathList.findClass(DexPathList.java:338)
04-09 19:23:54.286: E/AndroidRuntime(2419): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
04-09 19:23:54.286: E/AndroidRuntime(2419): ... 13 more
04-09 19:23:54.286: E/AndroidRuntime(2419): Suppressed: java.lang.ClassNotFoundException: com.mygdx.game.AndroidLauncher
04-09 19:23:54.286: E/AndroidRuntime(2419): at java.lang.Class.classForName(Native Method)
04-09 19:23:54.286: E/AndroidRuntime(2419): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
04-09 19:23:54.286: E/AndroidRuntime(2419): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
04-09 19:23:54.286: E/AndroidRuntime(2419): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
04-09 19:23:54.286: E/AndroidRuntime(2419): ... 12 more
04-09 19:23:54.286: E/AndroidRuntime(2419): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
com。糟糕的逻辑。gdx。后端。AndroidAndroidApplication类未找到问题发生在eclipse中,您必须在项目属性的Java构建路径部分的Order and Export选项卡中检查项目和外部依赖项。
之后,该项目将在android上运行。
工作示例
我只是在Eclipse中遇到了这个问题。当我遵循Android Studio的安装说明时,问题没有发生。
默认情况下,您的libgdx资产“badlogic.jpg”位于“project_direcotry/Android/资产”中。
该错误发生在未正确设置工作目录时,这会导致应用程序无法找到数据文件。要解决此问题,您需要正确设置工作目录。
如果您正在使用intelij idea或android studio(基于idea):线程“LWJGL应用程序”中的Libgdx项目异常,请选中此链接。无法加载文件。内部错误日志
如果您在运行新的LibGDX项目时使用eclipse:“未找到文件”,请选中此项
问题内容: 这是启动桌面版本时得到的: 我都试过这个政党成员和这一个,我也得到了同样的错误在同一直线上。 编辑: 我只是注意到我的.tmx文件的数据是由Tiled Map Editor自动编码的,所以我只是停用了它,但仍然遇到相同的错误。 如果我复制/粘贴该项目(我的意思是整个项目,不仅是render()方法),它会工作,但是当我尝试在自己的项目中加载自己的地图时,它只会崩溃… 因此,在那之后,我
问题 你的程序崩溃后该怎样去调试它? 解决方案 如果你的程序因为某个异常而崩溃,运行 python3 -i someprogram.py 可执行简单的调试。 -i 选项可让程序结束后打开一个交互式shell。 然后你就能查看环境,例如,假设你有下面的代码: # sample.py def func(n): return n + 10 func('Hello') 运行 python3 -
问题内容: 当我尝试访问Flask应用程序时,该应用程序崩溃了。 这类似于this或this。但是,我的设置似乎正确。 flask.cli.NoAppException:提供的文件/路径(服务器)似乎不存在。请确认路径正确。如果应用不在PYTHONPATH上,请确保扩展名为.py 我的环境变量设置正确。 我的服务器文件是y目录中没有任何文件。 我不记得对代码进行任何特殊更改。该错误可能来自哪里?
在以前的代码上,谁医生帮了我 现在,android应用程序在我的手机上运行时崩溃了,这是错误日志 第一个问题是在我用相机扫描二维码后,它不能显示在二维码的结果进入 第二个问题是,我从存储器中选择了一个QRcode图像,然后点击确认,它崩溃了 下面是我认为的问题 类型不匹配:推断的类型是Uri?但乌里是意料之中的 冗余SAM构造函数 'onRequestPermissionsResult(Int,数
注意:在我添加广告之前,我的应用程序运行良好,使用相同的方法 当我试图将adview添加到我的应用程序时,它会使我的应用程序崩溃,所以我删除了它,但仍然给我这个这是logcat 10-12 21:33:19.765 4993-4993/com。fm360。almorfis E/AndroidRuntime:致命异常:主进程:com。fm360。阿尔莫菲斯,PID:4993爪哇。lang.Runti
我已经编写了一个混合应用程序,它使用react原生svg在react原生视图中呈现svg图像。一切都很完美。今天,当我为我的应用程序创建release apk并将其部署到模拟器时,它崩溃了,出现了一个错误: 只有当我从proguard规则中注释时,我才会看到这个问题。专业文件。我想混淆我的apk代码(我无法控制)。我使用的proguard文件与本例中显示的类似,https://github.com