AIR for Android
工程项目,建立步骤如下:1.
下载工程项目所需的资源文件 air_for_android-flex_4_5-air_2_6-v_1 2.
建立 Android 工程 TestAIR (注意不要勾选Create Activity,先不创建Activity)
Porject Name: TestAIR
Standard Android Platform: 2.2
Application Name: TestAIR
Package Name: com.carey
Min SDK Version: 8

将下载下来的资源文件覆盖新创建工程的同名目录和文件,包括 assets 和 res,airbootstap.jar 将作为链接库 4.
删除"res/layout" 目录 5.
将 airbootstrap.jar 添加到 Build Path 6.
新建一个Class文件,名称为 MainApp,内容如下:
package com.carey;
import air.app.AppEntry;
import android.os.Bundle;
public class MainApp extends AppEntry {
@Override
public void onCreate(Bundle arg0) {
System.out.println("carey test adobe air for android!!!");
super.onCreate(arg0);
}
}
- 更新 Manifest 文件中的 Activity 为 MainApp
内容如下:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.carey" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="@drawable/icon" android:label="TestAIR">
<activity android:theme="@style/Theme.NoShadow" android:label="app" android:name=".MainApp"
android:launchMode="singleTask" android:screenOrientation="nosensor"
android:configChanges="keyboardHidden|orientation" android:windowSoftInputMode="stateHidden|adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
- 运行程序,可以看到log的输出和屏幕的显示 log输出如下:
06-05 12:38:40.855: INFO/System.out(422): carey test adobe air for android!!!

- 如果现在手机还没有安装Adobe AIR for Androi的话,屏幕会提示是否需要安装,

Adobe AIR for Android_2.6.0.1915.apk 下载
-
如果安装过程中出现 Failure [INSTALL_FAILED_INVALID_APK] 的错误
解决方法如下:there is a change when creating an apk for a device or an emulator.
So adt.exe/jar is ok, you just need to provide different -target value, i.e.:1.
For physical device:
adt.bat -package -target apk -storetype pkcs12 -keystore [keystore_positon] mobitest.apk MobileEmuTest-app.xml .
For emulator:
adt.bat -package -target apk-emulator -storetype pkcs12 -keystore [keystore_positon] mobitest.apk MobileEmuTest-app.xml .
或者修改 build.xml 如下:change
<property name="apk.target" value="apk"/>
to
<property name="apk.target" value="apk-emulator"/>
in build.xml file, and can install on the emulator device 本文源代码下载
加入讨论
新评论 — 条评论保存在本站自托管服务里,无需注册登录,填个昵称就能留言;不依赖任何第三方 Cookie 或账号。请尽量说点有用的 :)