APK Deployment Issue

I managed to create a * .apk file from my code, put the file in IIS, and upload it to several Android phones. On install, the application works exactly as expected.

However, after rebooting the phone, the application name changes to the fully qualified java class name for the activity in the menu (so "MyActivity" becomes "com.mycompany.MyActivity"), and when I try to go to menu> Settings, I get an error message that causes Android force close my application.

Looking in DDMS, I see that I get an error indicating that it may not detect my activity in Preferences, despite the fact that install, it works correctly.

I use Eclipse on Windows XP and have several Android devices at my disposal for testing.

Any idea what is going on?

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.company.app"
  android:versionCode="1"
  android:versionName="1.0">
<application android:icon="@drawable/logo" android:label="@string/app_name"> <!--android:debuggable="true">-->
    <activity android:name="com.company.app.ActivityMain"
              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.company.app.Preferences"
              android:label="@string/app_settings">
              <intent-filter>
                <category android:name="android.intent.category.PREFERENCE"></category>
                <action android:name="android.intent.action.MAIN"></action>
              </intent-filter>
    </activity>
    <service android:name="com.company.app.Service"></service>
</application>
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
</manifest> 
+3
source share
2 answers

So, I finally got it to work. I think the package installer on HTC Hero (and possibly HTC Droid Eris) has some problems.

I deleted my application from the phone, changed the name of my main activity and redeployed it to Hero. I immediately started Force Close. I connected the device to DDMS and looked at the error. He was still looking for my former name of activity. I factory reset the device and reinstall the same package (with the updated name), and everything will work as expected.

, , - , , . , .

, - , , -, HTC?

+2

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.company.app"
  android:versionCode="1"
  android:versionName="1.0">
<application android:icon="@drawable/logo" android:label="@string/app_name"> <!--android:debuggable="true">-->
    <activity android:name=".ActivityMain"
              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=".Preferences"
              android:label="@string/app_settings">
              <intent-filter>
                <category android:name="android.intent.category.PREFERENCE"></category>
                <action android:name="android.intent.action.MAIN"></action>
              </intent-filter>
    </activity>
    <service android:name=".Service"></service>
</application>
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
</manifest>
0

Source: https://habr.com/ru/post/1730491/


All Articles