尝试安装* .apk文件抛出ParseError

问题描述:

我可以安装我的** - unaligned.apk我的设备上。 但我无法安装我的可释放apk。我得到:尝试安装* .apk文件抛出ParseError

ParseError: Parsing the package...

这怎么可能?

如何构建我的应用程序:

call cordova plugin add org.apache.cordova.device 
call cordova plugin add org.apache.cordova.splashscreen 

call cordova platform add android 
call cordova build android call cordova build android --release 

call jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my.keystore -storepass **** platforms/android/ant-build/MainActivity-release-unsigned.apk myalias 

call jarsigner -verify -verbose -certs platforms/android/ant-build/MainActivity-release-unsigned.apk zipalign 
    -v 4 platforms/android/ant-build/MainActivity-release-unsigned.apk release.apk 

我的config.xml文件看起来像:

<?xml version="1.0" encoding="utf-8" standalone="no"?> 
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="com.myapp.test" version="2.0.1"> 
    <name>MyApp</name> 
    <author>Me</author> 

<preference name="AutoHideSplashScreen" value="false" /> 

<feature name="http://api.phonegap.com/1.0/device"/> 
<feature name="http://api.phonegap.com/1.0/network"/> 
<feature name="http://api.phonegap.com/1.0/file"/> 
<feature name="http://api.phonegap.com/2.0/globalization"/> 
<content src="index.html"/> 
<access origin="*"/> 


<preference name="android-minSdkVersion" value="17" /> 

<preference name="SplashScreen" value="screen" /> 
<preference name="SplashScreenDelay" value="10000" /> 

<platform name="android"> 
    <splash src="android/splash/land/hdpi.png" density="land-hdpi"/> 
    <splash src="android/splash/land/hdpi.png" density="land-ldpi"/> 
    <splash src="android/splash/land/hdpi.png" density="land-mdpi"/> 
    <splash src="android/splash/land/hdpi.png" density="land-xhdpi"/> 

    <splash src="android/splash/port/hdpi.png" density="port-hdpi"/> 
    <splash src="android/splash/port/ldpi.png" density="port-ldpi"/> 
    <splash src="android/splash/port/mdpi.png" density="port-mdpi"/> 
    <splash src="android/splash/port/xhdpi.png" density="port-xhdpi"/> 

    <icon src="android/ldpi.png" density="ldpi" /> 
    <icon src="android/mdpi.png" density="mdpi" /> 
    <icon src="android/hdpi.png" density="hdpi" /> 
    <icon src="android/xhdpi.png" density="xhdpi" /> 
</platform> 

生成AndroidManifest.xml中有targetSdk = 21。这是Android 5.0.1 ..我的设备是Android 5.0。我可以在我的config.xml中指定targetSdk吗?

+0

是您的文件名中的任何一个与下划线(_)开始,要检查http://*.com/a/22618261/1225413 – 2015-04-02 13:18:38

+0

号我可以安装* unaligned.apk。问题出在zipaligned上。 – OOPDeveloper89 2015-04-02 13:20:34

在你的config.xml中,你会发现包的名称。注下来,并同时zipalign,使用该软件包的名称,而不是发布的.apk的。让我知道这是行不通的。

+0

嗨,谢谢你的回答。我添加我的config.xml并使用com.myapp.test.apk运行构建,但没有工作。 – OOPDeveloper89 2015-04-02 13:02:38

+0

但我看到一个观点:我的设备是Android的5.0 ...的targetSDK IST的AndroidManifest.xml中API 21,这就是Android 5.0.1 ...这可能是什么问题?但我认为,我也无法安装unaligned.apk ... – OOPDeveloper89 2015-04-02 13:10:54