解決:Application package 'AndroidManifest.xml' must have a minimum of 2 segments.
在移植J2ME API測試專案時,一直碰到一個問題得不到解決就是AndroidManifest.xml下的package參數值問題,在Android開發環境中要求package包名必須是二級以上否則編譯時間
Application package 'AndroidManifest.xml' must have a minimum of 2 segments.這個問題一直讓我頭疼,因為大量J2ME項目中其主類可能只是一級包名,剛開始只能忍著利用Eclipse重構包名,還好這個方便
可畢竟只能治標不治本,後來想到一個方法:先寫個啟動的有二級包名的主Activity,然後利用Intent機制在這個Activity去啟動另外一個,理論上是通的,可是繞來繞去有回到了這個package參數值問題,因為測
試中發現要想通Intent成功啟動另外一個Activity,首先必須在AndroidManifest.xml(可以本應用的也可以是另外一個應用的)下定義這個Activity,如果你不定義那就去見一大堆的:
ERROR/AndroidRuntime(1550): android.content.ActivityNotFoundException: Unable to find explicit activity class {finger.mobeasy/test.cjm.Report}; have you declared this activity in your AndroidManifest.xml?
後來實在沒招:就硬硬生生的在AndroidManifest.xml定義了全名Activity沒想OK了,原來其實可以這樣定義,只能怪自己理解有誤,沒仔細看API文檔:摘自android API中NativeActivity介紹
A typical manifest would look like:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.native_activity"
android:versionCode="1"
android:versionName="1.0">
<!-- This is the platform API where NativeActivity was introduced. -->
<uses-sdkandroid:minSdkVersion="8"/>
<!-- This .apk has no Java code itself, so set hasCode to false. -->
<applicationandroid:label="@string/app_name"android:hasCode="false">
<!-- Our activity is the built-in NativeActivity framework class.
This will take care of integrating with our NDK code. -->
<activityandroid:name="android.app.NativeActivity"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden">
<!-- Tell NativeActivity the name of or .so -->
<meta-dataandroid:name="android.app.lib_name"
android:value="native-activity"/>
<intent-filter>
<actionandroid:name="android.intent.action.MAIN"/>
<categoryandroid:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>