gpt4 book ai didi

android - 将 Scala 2.8 移植到 Netbeans NBAandroid 项目中......我缺少哪些步骤?

转载 作者:行者123 更新时间:2023-11-30 04:52:49 26 4
gpt4 key购买 nike

由于 Apple 最近的 T+C 狂欢,我开始对 Android 开发感兴趣。

无论如何,我正在尝试在 Netbeans 6.8(使用 NBAandroid 0.10 插件)中运行一个混合语言的 Android 2.1 项目。这两种语言是 Java 和 Scala(2.8 head build)。为了让您大致了解该应用现在的功能,它只是一个简单的“Hello World”应用。

为了构建它,我修改了项目的 build.xml 文件:

 <target name="-pre-compile" depends="init">
<property name="scala-home" value="/Users/development/Applications/scala-2.8.0/build/pack"/>
<property name="scala-library" value="/Users/development/Applications/scala-2.8.0/build/pack/lib/scala-library.jar"/>
<echo message="scala-library = ${scala-library}"/>
<echo message="scala-home = ${scala-home}"/>
<echo message="platform.bootcp = ${platform.bootcp}"/>
<echo message="dist.apk.dir = ${dist.apk.dir}"/>
<echo message="build.classes.dir = ${build.classes.dir}"/>
<path id="build.classpath">
<pathelement location="${scala-library}" />
<!--<pathelement location="${your.path}" />-->
<pathelement location="${build.classes.dir}" />
</path>
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath>
<pathelement location="${scala.home}/lib/scala-compiler.jar" />
<pathelement location="${scala-library}" />
<pathelement location="${javac.classpath}" />
</classpath>
</taskdef>
<scalac srcdir="${src.ScalaSource.dir}" destdir="${build.classes.dir}" >
<classpath>
<pathelement location="/Users/development/Documents/AndroidTest/scala-library.jar" />
<pathelement location = "${scala-library}" />
<pathelement location = "${file.reference.android.jar}" />
<pathelement path="${javac.classpath}" />
</classpath>
</scalac>
<echo message="file.reference.android.jar: ${file.reference.android.jar}"/>
<echo message="file.reference.scala-library.jar: ${file.reference.scala-library.jar}"/>
</target>

<target name="-pre-jar">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
<taskdef resource="proguard/ant/task.properties"
classpath="tools/proguard.jar" />
<proguard>
-injars ${scala-library}(!META-INF/MANIFEST.MF,!library.properties)
-outjars "${build.classes.dir}/classes.min.jar"
-libraryjars "${file.reference.android.jar}"
-dontwarn
-dontoptimize
-dontobfuscate
-keep public class * extends android.app.Activity
-keep public class scala.xml.include.sax.Main**
</proguard>
</target>

我已经得到了项目,所以它可以构建,但它在我的 Android 模拟器中启动时出错(在模拟器中 Android 告诉我我的应用程序意外停止)。

所以我的问题是:有人看到我可能做错了什么吗?有没有什么方法可以访问模拟器必须创建的日志?

谢谢

编辑:仅供引用,这是 adb logcat 的输出:

I/dalvikvm(  369): Failed resolving Lorg/me/androidtest/MainActivity; interface 35 'Lscala/ScalaObject;'
W/dalvikvm( 369): Link of class 'Lorg/me/androidtest/MainActivity;' failed
D/AndroidRuntime( 369): Shutting down VM
W/dalvikvm( 369): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
E/AndroidRuntime( 369): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 369): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.me.androidtest/org.me.androidtest.MainActivity}: java.lang.ClassNotFoundException: org.me.androidtest.MainActivity in loader dalvik.system.PathClassLoader@43d02720
E/AndroidRuntime( 369): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
E/AndroidRuntime( 369): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
E/AndroidRuntime( 369): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
E/AndroidRuntime( 369): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
E/AndroidRuntime( 369): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 369): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 369): at android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime( 369): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 369): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 369): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 369): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 369): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 369): Caused by: java.lang.ClassNotFoundException: org.me.androidtest.MainActivity in loader dalvik.system.PathClassLoader@43d02720
E/AndroidRuntime( 369): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
E/AndroidRuntime( 369): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
E/AndroidRuntime( 369): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
E/AndroidRuntime( 369): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
E/AndroidRuntime( 369): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
E/AndroidRuntime( 369): ... 11 more
I/Process ( 56): Sending signal. PID: 369 SIG: 3
I/dalvikvm( 369): threadid=7: reacting to signal 3
I/dalvikvm( 369): Wrote stack trace to '/data/anr/traces.txt'
W/ActivityManager( 56): Launch timeout has expired, giving up wake lock!

很明显,这是某种类型的类加载器/类路径问题或其他问题(至少如果这是 JVM,我会这么说),但是当我查看我的 Proguard'd jarfile 时,我发现我期望的类: scala.ScalaObject、org.me.androidtest.MainActivity 和其他一些。

如果它对项目有帮助,它的所有内部依赖项位于 http://philosophicalsoftware.com/AndroidTest.zip

最佳答案

Does anyone see what I may be doing wrong?

是的。你没有任何源代码。 :-)

And is there any way to get access to the logs that the emulator must create?

我不确定 Netbeans 的内部情况,但您可以使用 adb logcat 或 DDMS 检查日志,其中将包含……嗯……一些东西。通常,我会说“显示异常原因的 Java 堆栈跟踪”,但我不能 100% 确定 Scala 应用程序会发生什么(尽管我计划很快进行一些 Scala/Android 实验)。

关于android - 将 Scala 2.8 移植到 Netbeans NBAandroid 项目中......我缺少哪些步骤?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2626471/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com