我刚刚发现了一些关于Android studio的奇怪之处:它在build.gradle文件中有一些配置选项可以覆盖文件中指定的AndroidManifest.xml内容.
例如,我有以下几行build.gradle:
android {
compileSdkVersion 18
buildToolsVersion "18.1.1"
defaultConfig {
minSdkVersion 10
targetSdkVersion 10
}
...
}
Run Code Online (Sandbox Code Playgroud)
它覆盖了相应的标签AndroidManifest.xml:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8"/>
Run Code Online (Sandbox Code Playgroud)
我真的不喜欢有两个不同的文件传播相同的设置,所以我想知道如果我可以放心地无论是从删除它build.gradle或AndroidManifest.xml与它更有意义,保持它.
我看过其他有关该帖子的帖子,INSTALL_PARSE_FAILED_MANIFEST_MALFORMED但仍无法弄清楚我的特定清单有什么问题.有什么建议?
<?xml version="1.0" encoding="utf-8"?>
Run Code Online (Sandbox Code Playgroud)
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="ThePackage.SnapVest.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="ThePackage.SnapVest.MyActiveOptions"
android:label="@string/title_activity_my_active_options" >
</activity>
<activity
android:name="ThePackage.SnapVest.MyTrades"
android:label="@string/title_activity_my_trades" >
</activity>
<activity
android:name="ThePackage.SnapVest.MyAccount"
android:label="@string/title_activity_my_account" >
</activity>
<activity
android:name="ThePackage.SnapVest.Leaderboard"
android:label="@string/title_activity_leaderboard" >
</activity>
</application>
Run Code Online (Sandbox Code Playgroud)
那么,我的错误在哪里?
这是我运行时的实际顺序:
Waiting for device.
Target device: kyocera-event-1001c1c
Uploading file
local path: C:\Users\Roger Garrett\AndroidStudioProjects\SnapVest\app\build\apk\app-debug-unaligned.apk
remote path: /data/local/tmp/ThePackage.SnapVest
Installing ThePackage.SnapVest
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/ThePackage.SnapVest"
pkg: /data/local/tmp/ThePackage.SnapVest
Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]
Run Code Online (Sandbox Code Playgroud) 我尝试了一切,重命名包,更改权限等,仍然在我的控制台上看到错误INSTALL_PARSE_FAILED_MANIFEST_MALFORMED.
我尝试从logcat进行日志记录,这就是它所说的"在installPackageLI期间解析失败"和"android.content.pm.PackageParser $ PackageParserException:/data/app/vmdl170122893.tmp/base.apk"(在二进制XML文件行#33处) ):没有有效的android:name"和atlast说"调试器不再有效"
我试着在em21即Lollipop SDK上运行.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="Ca.Rushabh.Mobileproject"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<permission
android:name="com.example.mymapsv2.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.mymapsv2.permission.MAPS_RECEIVE" />
<application
android:allowBackup="true"
android:icon="@drawable/blue_droid"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="Ca.Rushabh.Mobileproject.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="Ca.Rushabh.Mobileproject.About"
android:label="@string/title_activity_about"
android:theme="@android:style/Theme.Dialog" >
</activity>
<activity
android:name="Ca.Rushabh.Mobileproject.ToDoList"
android:label="abcd" />
<activity
android:name="Ca.Rushabh.Mobileproject.ToDoDetailActivity" …Run Code Online (Sandbox Code Playgroud)