为何偶的手机无法运行Hello World?

qps2006 2015-03-01 06:42:13
Hello World 已成功build ,是release版
复制到手机里,无法安装,说是出现未知类型错误

偶的SDK应该是最新的,但手机较老,大概是Android 2.x(手机型号是华为Sonic)
问题是不是出在这里?在build时是否可设置选项,以使老手机也能运行?

谢谢!!!
...全文
254 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
引用 5 楼 qps2006 的回复:
感谢各位热心帮助!但问题还没解决,仍是未知类型错误 自动创建的AndroidManifest.xml中没有uses-sdk,偶不知道加在哪 以下是AndroidManifest.xml,请帮偶看看uses-sdk加得对不对,谢谢! <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.foo" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> <activity android:name="FooActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
<activity android:name="FooActivity" 这一行,在FooActivity前加一个.试试,不行的话在加个FooActivity的完整路径加上(包名.xxx)
qps2006 2015-03-02
  • 打赏
  • 举报
回复
以下是ant release命令返回的结果,看看有没有问题,谢谢! Buildfile: /home/zhou/wj/build.xml -set-mode-check: -set-release-mode: -release-obfuscation-check: [echo] proguard.config is ${proguard.config} -pre-build: -check-env: [checkenv] Android SDK Tools Revision 24.0.2 [checkenv] Installed at /home/zhou/Android/Sdk -setup: [echo] Project Name: Foo [gettype] Project Type: Application -build-setup: [getbuildtools] Using latest Build Tools: 21.1.2 [echo] Resolving Build Target for Foo... [gettarget] Project Target: Android 5.0.1 [gettarget] API level: 21 [echo] ---------- [echo] Creating output directories if needed... [echo] ---------- [echo] Resolving Dependencies for Foo... [dependency] Library dependencies: [dependency] No Libraries [dependency] [dependency] ------------------ [echo] ---------- [echo] Building Libraries with 'release'... [subant] No sub-builds to iterate on -code-gen: [mergemanifest] No changes in the AndroidManifest files. [echo] Handling aidl files... [aidl] No AIDL files to compile. [echo] ---------- [echo] Handling RenderScript files... [echo] ---------- [echo] Handling Resources... [aapt] No changed resources. R.java and Manifest.java untouched. [echo] ---------- [echo] Handling BuildConfig class... [buildconfig] No need to generate new BuildConfig. -pre-compile: -compile: -post-compile: -obfuscate: -dex: [dex] input: /home/zhou/wj/bin/classes [dex] No new compiled code. No need to convert bytecode to dalvik format. -crunch: [crunch] Crunching PNG Files in source dir: /home/zhou/wj/res [crunch] To destination dir: /home/zhou/wj/bin/res [crunch] Crunched 0 PNG files to update ca [crunch] che -package-resources: [aapt] No changed resources or assets. Foo.ap_ remains untouched -package: [apkbuilder] No changes. No need to create apk. -post-package: -release-prompt-for-password: -release-nosign: [echo] No key.store and key.alias properties found in build.properties. [echo] Please sign /home/zhou/wj/bin/Foo-release-unsigned.apk manually [echo] and run zipalign from the Android SDK tools. [propertyfile] Updating property file: /home/zhou/wj/bin/build.prop [propertyfile] Updating property file: /home/zhou/wj/bin/build.prop [propertyfile] Updating property file: /home/zhou/wj/bin/build.prop [propertyfile] Updating property file: /home/zhou/wj/bin/build.prop -release-sign: -post-build: release: BUILD SUCCESSFUL Total time: 2 seconds
qps2006 2015-03-02
  • 打赏
  • 举报
回复
感谢各位热心帮助!但问题还没解决,仍是未知类型错误 自动创建的AndroidManifest.xml中没有uses-sdk,偶不知道加在哪 以下是AndroidManifest.xml,请帮偶看看uses-sdk加得对不对,谢谢! <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.foo" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> <activity android:name="FooActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
liuh6 2015-03-02
  • 打赏
  • 举报
回复
android:minSdkVersion="8" 值改为你手机的sdk版 本号
budworm 2015-03-02
  • 打赏
  • 举报
回复
是这样的... 如果你已经建好工程,你可以修改AndroidManifest.xml中的 <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> 将里面的minSdkVersion改到Android 2.x匹配的版本,具体版本编号可以参考 http://blog.csdn.net/happytengfei/article/details/8679709
sinat_26256719 2015-03-02
  • 打赏
  • 举报
回复
一楼正解!!! 如果你已经建好工程,你可以修改AndroidManifest.xml中的 <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> 将里面的minSdkVersion改到Android 2.x匹配的版本,具体版本编号可以参考 http://blog.csdn.net/happytengfei/article/details/8679709
水的川 2015-03-02
  • 打赏
  • 举报
回复
你在新建hello world项目的时候,最低的sdk版本设置低一点就可以了。。
qps2006 2015-03-02
  • 打赏
  • 举报
回复
两个都试过了,都不行,老问题 没想到搞定这个问题会这么难
  • 打赏
  • 举报
回复
引用 8 楼 qps2006 的回复:
[quote=引用 7 楼 u012301841 的回复:] [quote=引用 5 楼 qps2006 的回复:] 感谢各位热心帮助!但问题还没解决,仍是未知类型错误 自动创建的AndroidManifest.xml中没有uses-sdk,偶不知道加在哪 以下是AndroidManifest.xml,请帮偶看看uses-sdk加得对不对,谢谢! <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.foo" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> <activity android:name="FooActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
<activity android:name="FooActivity" 这一行,在FooActivity前加一个.试试,不行的话在加个FooActivity的完整路径加上(包名.xxx)[/quote] 看了您的回复,偶仍不知如何加 您能否把加好后的AndroidManifest.xml完整地帖出来?谢谢![/quote] <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.foo" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> <activity android:name=".FooActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> 在或者 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.foo" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> <activity android:name="com.example.foo.FooActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> 这2个都试试把,还有你要确定下FooActivity这个类所在的包是不是com.example.foo,如果不是的话,就在第二个方法下替换下
qps2006 2015-03-02
  • 打赏
  • 举报
回复
引用 7 楼 u012301841 的回复:
[quote=引用 5 楼 qps2006 的回复:] 感谢各位热心帮助!但问题还没解决,仍是未知类型错误 自动创建的AndroidManifest.xml中没有uses-sdk,偶不知道加在哪 以下是AndroidManifest.xml,请帮偶看看uses-sdk加得对不对,谢谢! <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.foo" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> <activity android:name="FooActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
<activity android:name="FooActivity" 这一行,在FooActivity前加一个.试试,不行的话在加个FooActivity的完整路径加上(包名.xxx)[/quote] 看了您的回复,偶仍不知如何加 您能否把加好后的AndroidManifest.xml完整地帖出来?谢谢!

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧