尝试安装* .apk会抛出ParseError

时间:2015-04-02 11:58:50

标签: android cordova

我可以在我的设备上安装我的** - unaligned.apk。 但我无法安装我的可释放apk。我明白了:

  

ParseError:解析包...

这怎么可能?

如何构建我的应用:

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吗?

1 个答案:

答案 0 :(得分:0)

在config.xml中,您将找到包名称。请注意,在zipalign期间,请使用该包名称而不是发布 .apk。如果这不起作用,请告诉我。