我是Flash和Actionscript的新手,我正在尝试构建一个在Android设备或模拟器上运行的测试应用程序。 (使用Flash播放器运行它可以正常工作)。
当我在模拟器(基于ARM)或真实设备(Nexus 7)上goto android-test
部署并运行Run.bat
的测试APK时,它会以The application [name] has stopped unexpectedly
终止。
当我尝试调试时,另一方面使用goto android-debug
,它只会出现一个空白屏幕。
在FlashDevelop中,我看不到进一步的日志消息,指出设备或模拟器上发生了什么类型的错误。
以前,由于application.xml
中的命名空间,我遇到了无法构建APK的问题:
<application xmlns="http://ns.adobe.com/air/application/14.0">
我想知道它是否从我之前项目中设置的Flash Player版本获得了14.0
。将其更改为3.1
以匹配我认为的AIR运行时版本后,它编译了APK,但现在我遇到了这个问题。
我正在使用 Flex SDK 4.6 和 FlashDevelop 4.6.2.5 。
这是我的主要课程:
package ceronio.net
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
/**
* ...
* @author Martin
*/
public class Main extends Sprite
{
public function Main():void
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.DEACTIVATE, deactivate);
// touch or gesture?
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
}
private function deactivate(e:Event):void
{
}
}
}
这是我的application.xml
:
<?xml version="1.0" encoding="utf-8" ?>
<application xmlns="http://ns.adobe.com/air/application/3.1">
<id>ceronio.net.mobile2</id>
<versionNumber>0.1</versionNumber>
<supportedProfiles>mobileDevice</supportedProfiles>
<filename>mobile2</filename>
<name>mobile2</name>
<description></description>
<copyright></copyright>
<android>
<manifestAdditions><![CDATA[
<manifest android:installLocation="auto">
<uses-sdk android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>
</manifest>
]]></manifestAdditions>
</android>
<iPhone>
<InfoAdditions><![CDATA[
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>
<key>UIRequiresPersistentWiFi</key>
<string>NO</string>
<key>UIPrerenderedIcon</key>
<true/>
<key>UIApplicationExitsOnSuspend</key>
<true/>
<key>UIDeviceFamily</key>
<array>
<!-- iPhone support -->
<string>1</string>
<!-- iPad support -->
<!--<string>2</string>-->
</array>
]]></InfoAdditions>
<requestedDisplayResolution>high</requestedDisplayResolution>
</iPhone>
<initialWindow>
<title>mobile2</title>
<content>mobile2.swf</content>
<visible>true</visible>
<fullScreen>true</fullScreen>
<renderMode>direct</renderMode>
</initialWindow>
<icon>
<image48x48>icons/icon_48.png</image48x48>
<image57x57>icons/icon_57.png</image57x57>
<image72x72>icons/icon_72.png</image72x72>
</icon>
</application>
感谢Hiemanshu的评论,它指向了logcat。使用它,我得到了以下日志,这让我想知道它是否无法引用AIR运行时。我确实按照说明首先使用InstallAirRuntime.bat
部署运行时。
D/dalvikvm( 659): Trying to load lib /data/data/com.adobe.air/lib/libCore.so 0x4051c380
I/dalvikvm( 659): Failed resolving Lcom/adobe/air/AIRWindowSurfaceView$2; interface 153 'Landroid/view/View$OnSystemUiVisibilityChangeListener;'
W/dalvikvm( 659): Link of class 'Lcom/adobe/air/AIRWindowSurfaceView$2;' failed
E/dalvikvm( 659): Could not find class 'com.adobe.air.AIRWindowSurfaceView$2', referenced from method com.adobe.air.AIRWindowSurfaceView.DoSetOnSystemUiVisibilityChangeListener
W/dalvikvm( 659): VFY: unable to resolve new-instance 213 (Lcom/adobe/air/AIRWindowSurfaceView$2;) in Lcom/adobe/air/AIRWindowSurfaceView;
D/dalvikvm( 659): VFY: replacing opcode 0x22 at 0x0000
D/dalvikvm( 659): VFY: dead code 0x0002-0008 in Lcom/adobe/air/AIRWindowSurfaceView;.DoSetOnSystemUiVisibilityChangeListener ()V
I/dalvikvm( 659): Could not find method android.view.View.setSystemUiVisibility, referenced from method com.adobe.air.AIRWindowSurfaceView.clearFullScreen
W/dalvikvm( 659): VFY: unable to resolve virtual method 395: Landroid/view/View;.setSystemUiVisibility (I)V
D/dalvikvm( 659): VFY: replacing opcode 0x6e at 0x001a
I/dalvikvm( 659): Could not find method android.view.View.setSystemUiVisibility, referenced from method com.adobe.air.AIRWindowSurfaceView.setFullScreen
W/dalvikvm( 659): VFY: unable to resolve virtual method 395: Landroid/view/View;.setSystemUiVisibility (I)V
D/dalvikvm( 659): VFY: replacing opcode 0x6e at 0x001c
I/dalvikvm( 659): Could not find method android.view.ScaleGestureDetector.getCurrentSpanX, referenced from method com.adobe.air.gestures.AIRGestureListener.onScale
W/dalvikvm( 659): VFY: unable to resolve virtual method 367: Landroid/view/ScaleGestureDetector;.getCurrentSpanX ()F
D/dalvikvm( 659): VFY: replacing opcode 0x74 at 0x0040
I/dalvikvm( 659): Could not find method android.view.ScaleGestureDetector.getPreviousSpanX, referenced from method com.adobe.air.gestures.AIRGestureListener.onScale
W/dalvikvm( 659): VFY: unable to resolve virtual method 372: Landroid/view/ScaleGestureDetector;.getPreviousSpanX ()F
D/dalvikvm( 659): VFY: replacing opcode 0x74 at 0x009a
D/dalvikvm( 659): VFY: dead code 0x0043-0067 in Lcom/adobe/air/gestures/AIRGestureListener;.onScale (Landroid/view/ScaleGestureDetector;)Z
D/dalvikvm( 659): VFY: dead code 0x009d-0115 in Lcom/adobe/air/gestures/AIRGestureListener;.onScale (Landroid/view/ScaleGestureDetector;)Z
D/dalvikvm( 659): VFY: dead code 0x0136-013a in Lcom/adobe/air/gestures/AIRGestureListener;.onScale (Landroid/view/ScaleGestureDetector;)Z
W/OrientationEventListener( 659): Cannot detect sensors. Not enabled
W/dalvikvm( 659): No implementation found for native Lcom/adobe/air/AIRWindowSurfaceView;.nativeOnFormatChangeListener (I)V
D/AndroidRuntime( 659): Shutting down VM
W/dalvikvm( 659): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime( 659): FATAL EXCEPTION: main
E/AndroidRuntime( 659): java.lang.UnsatisfiedLinkError: nativeOnFormatChangeListener
E/AndroidRuntime( 659): at com.adobe.air.AIRWindowSurfaceView.nativeOnFormatChangeListener(Native Method)
E/AndroidRuntime( 659): at com.adobe.air.AIRWindowSurfaceView.surfaceChanged(AIRWindowSurfaceView.java:683)
E/AndroidRuntime( 659): at android.view.SurfaceView.updateWindow(SurfaceView.java:549)
E/AndroidRuntime( 659): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:348)
E/AndroidRuntime( 659): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 659): at android.view.SurfaceView.draw(SurfaceView.java:334)
E/AndroidRuntime( 659): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 659): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 659): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 659): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 659): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 659): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 659): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 659): at android.widget.FrameLayout.draw(FrameLayout.java:357)
E/AndroidRuntime( 659): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1862)
E/AndroidRuntime( 659): at android.view.ViewRoot.draw(ViewRoot.java:1522)
E/AndroidRuntime( 659): at android.view.ViewRoot.performTraversals(ViewRoot.java:1258)
E/AndroidRuntime( 659): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
E/AndroidRuntime( 659): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 659): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 659): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 659): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 659): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 659): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 659): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 659): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 61): Force finishing activity air.air.ceronio.net.mobile2/.AppEntry
W/ActivityManager( 61): Activity pause timeout for HistoryRecord{40628908 air.air.ceronio.net.mobile2/.AppEntry}
D/dalvikvm( 305): GC_EXPLICIT freed 8K, 54% free 2542K/5511K, external 1625K/2137K, paused 72ms
W/ActivityManager( 61): Activity destroy timeout for HistoryRecord{40628908 air.air.ceronio.net.mobile2/.AppEntry}
D/dalvikvm( 315): GC_EXPLICIT freed 2K, 54% free 2539K/5511K, external 1625K/2137K, paused 100ms
D/dalvikvm( 217): GC_EXPLICIT freed 12K, 55% free 2595K/5703K, external 1625K/2137K, paused 74ms
答案 0 :(得分:0)
创建动作脚本AIR项目时,只有一个AIR版本可用,这与flex项目相对,您可以在其中定位不同的SDK版本。 FB确实为您设置了正确的版本:14.0,这是您需要使用的版本。尝试将其设置为3.1只能生成错误。我认为在你的情况下,主要的问题是你有大量的错误和错误,只是累积并使整个项目失败。解决方案,重新启动一个新的空项目,编译和测试,如果它不起作用回到这里与结果(这次这些结果不会与其他错误混合)。我的猜测是它可以正常工作,你只需要不搞乱项目设置。
答案 1 :(得分:0)
您可以尝试在Flex SDK中覆盖AIR SDK,因此您确定拥有最新的SDK。以下是有关覆盖http://helpx.adobe.com/x-productkb/multi/how-overlay-air-sdk-flex-sdk.html
的一般说明另外,我认为在Flash Develop中您可以安装多个Flex SDK并选择适合您项目的SDK。您可以在此处找到如何添加新SDK http://www.flashdevelop.org/wikidocs/index.php?title=Configuration#Configuring_the_Flex_SDK 然后,您可以在Flash Develop中打开项目,然后转到Project&gt;属性并选择3.9 SDK,它应该工作。我发现配置Flash Develop非常棘手。