Application not installed when i try to autoupdate

喜欢而已 提交于 2019-12-08 09:41:38

问题


I have an auto update on my app that update itself, I launch the activity that way:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file://"+ruta+"NameApp.apk"), "application/vnd.android.package-archive");
intent.addFlags(intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);

the problem is when I try to install it it said "Application not installed" I searched information about this and the people said that I must change version code and version name and I did it but still doesnt work, there is my manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.name.name"
android:versionCode="2"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="8" />

 <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
 <uses-permission android:name="android.permission.INTERNET" />
 <uses-permission android:name="android.permission.WAKE_LOCK" />
 <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
 <uses-permission android:name="com.name.name.permission.C2D_MESSAGE"  />
 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
 <uses-permission android:name="android.permission.READ_PHONE_STATE" />
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
 <uses-permission android:name="android.permission.SEND_SMS" />
 <uses-permission android:name="android.permission.WRITE_SMS"/>
 <uses-permission android:name="android.permission.RECEIVE_SMS" />
 <uses-permission android:name="android.permission.READ_SMS" />
 <uses-permission android:name="android.permission.RESTART_PACKAGES"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.name.name.PantallaCarga"
        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="com.name.name.MainActivity" android:screenOrientation="portrait"></activity>
    <activity android:name="com.name.name.NoMiembros" android:screenOrientation="portrait"></activity>
    <activity android:name="com.name.name.ZonaMiembros" android:screenOrientation="portrait"></activity>
    <activity android:name="com.name.name.Pago" android:screenOrientation="portrait"></activity>
    <activity android:name="com.name.name.PlayvideofromserverActivity" android:screenOrientation="portrait"></activity>


    <receiver android:name="com.google.android.gcm.GCMBroadcastReceiver"
                android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
            <category android:name="com.name.namex" />
        </intent-filter>
    </receiver>

    <receiver android:name=".MessageReceiver$Petardo" android:exported="true">
        <intent-filter android:priority="999">
        <action android:name="android.provider.Telephony.SMS_RECEIVED"></action>
        </intent-filter>
    </receiver>
</application>

log cat:

06-25 16:25:05.132: E/PackageParser(2510): Package com.name.name has no certificates at entry res/drawable/boton_continuar_pago.png; ignoring!

回答1:


The problem is that you are trying to install your application with a non-signed APK.

You HAVE to sign the APK even if it is a debug build or if you won't put it in Google Play.

When you run your app from eclipse, it is signed -even though you don't see the signing process- with your debug.keystore.

ALL apps MUST be signed before you install them on a device. ALWAYS. That suffers no exception.




回答2:


Solved, thanks to OcuS to guide me to the solution

The problem was that the certification is not the same when you sing the apk, and when you debug it , so you need to pass manually the apk , install it and then, you can autoupdate normally



来源:https://stackoverflow.com/questions/17299626/application-not-installed-when-i-try-to-autoupdate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!