APK Deployment Issue - android

I have been able to create a *.apk file from my code, place the file
in IIS, and download it onto a number of Android phones. Upon the
install, the application works exactly as expected.
However, after a phone is rebooted, the application name is changed to
the fully-qualified Java class name of the activity in the menu (so
"MyActivity" becomes "com.mycompany.MyActivity"), and when I try to go
to Menu > Settings, I get an error that causes android to force close
my application.
Looking into DDMS, I see that I get an error indicating that it can
not find my Preferences activity, despite the fact upon initial
install, it works properly.
I'm using Eclipse on Windows XP, and have several Android devices at
my disposal to test with.
Any idea what's 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>

So I finally got this to work. I think that the package installer on the HTC Hero (and maybe the HTC Droid Eris) has some issues.
I uninstalled my application from the phone, changed the name of my main activity, and re-deployed it onto the Hero. I started to immediately get a "Force Close." I connected the device to DDMS and looked at the error. It was still looking for my old activity name. I factory reset the device and reinstalled the same package (with the updated name) and everything works as expected.
So it seems that the package installer is caching some part of the old manifest or something, not really sure what exactly is going on there. I may play with it some more if I get time.
I don't know if someone else could verify this problem, maybe it's something that should be taken up with HTC?

try to use this manifest
<?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>

Related

Not able to install my application on other Android devices

I have made an Android app using AndroidStudio and want to test it on different phones. I have generated the signed apk (release version) and I could successfully install the apk on my device (Nexus 5).
Then I tried to install the same apk on a Nexus 4 but it throws an error after the installation that the package installer has stopped.
Here is what my manifest file looks like
<?xml version="1.0" encoding="utf-8"?>
<application
android:permission="android.permission.WRITE_EXTERNAL_STORAGE"
android:allowBackup="true"
android:icon="#drawable/endecrypt_ico"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".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=".PostSubmission"
android:label="#string/title_activity_post_submission"
android:parentActivityName=".MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.psimit.encrypt.MainActivity" />
</activity>
</application>
I am not able to understand where the problem lies. Since the app works when installed via the debugger and also using the apk on my phone, I am tempted to think if I need to do something more for compatibility across Nexus 4 and Nexus 5 during the generation of the signed apk.
I would quite appreciate some pointers if someone has encountered this problem earlier. Thanks in advance.
It's a really strange issue you have. Maybe you're doing things wrong.
The permissions should be at the root of the manifest tag :
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application>
<activity
...
</activity>
</application>
</manifest>

App Not Showing in Apps

I'm debugging using my Samsung Galaxy S5 and every time I run it through Android Studio it works fine and it pops up the app, but then when I click out of it it doesn't show in all of my apps like other apps I've installed to my device. The app will show in my task manager after I close out of it but it still won't show in all of my apps. Really could use some help on this one, thanks.
This is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="us.bisonsoftware.tab" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="Husky Athletics"
android:theme="#style/CustomActionBarTheme">
<activity
android:name=".TabBarExample"
android:label="Husky Athletics"
android:icon="#drawable/ic_launcher">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data android:scheme="geo"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".FirstTab" />
<activity android:name=".SecondTab" />
<activity android:name=".ThirdTab" />
</application>
<uses-permission android:name="android.permission.INTERNET" ></uses-permission>
<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>
Try to make your activity name complete like this:
<activity
android:name="com.example.myapp.TabBarExample"
... >
</activity>
I dont know your package name. You have to fill it by yourself.

app not starting, despite loading successfully

I am getting a strange issue, please see if anyone can help here. Whenever I run my app (either in emulator or in phone), I can see the installation goes successful but the activity does not show up. Following is the message I get in the Console.
------------------------------
Android Launch!
adb is running normally.
Performing sync
Uploading MyApp.apk onto device 'emulator-5554'
Installing MyApp.apk...
Success!
\MyApp\bin\MyApp.apk installed on device
Done!
It was running normally before but since yesterday, it has started to behave like this. Ideally after "Success!" statement, the intent gets loaded and MainActivity shows up. But not anymore. I tried restarting/recreating emulator but no help. The only change I had done in my app was to create some xml files for titlebar. I even undid that change but still the same issue. Any help is appreciated.
UPDATED TO ADD MANIFEST FILE
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bfp.MyApp"
android:versionCode="12"
android:versionName="2.5" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="10" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<permission
android:name="com.bfp.MyApp.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.bfp.MyApp.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme" >
<activity
android:name="com.bfp.MyApp.MainActivity"
android:label="#string/app_name"
android:configChanges="orientation|keyboardHidden|screenSize"
android:clearTaskOnLaunch="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.bfp.MyApp.TestQuizActivity"
android:parentActivityName="com.bfp.MyApp.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.bfp.MyApp.MainActivity" />
</activity>
<service android:name="com.bfp.MyApp.GCMIntentService" />
<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" />
<category android:name="com.bfp.MyApp" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.bfp.MyApp" />
</intent-filter>
</receiver>
<activity
android:name="com.bfp.MyApp.RegisterActivity"
android:launchMode="singleTop" />
<activity
android:name="com.bfp.MyApp.BaseActivity"
android:label="#string/title_activity_main" >
</activity>
</application>
Does your app run correctly when you run it from the phone directly? If so, perhaps you accidently changed the run configuration from eclipse to launch other activity than you MainActivity. This affect running from eclipse via the debug interface.
Looks like the problem was more while running the app from eclipse. Installing the apk file in phone was working fine. I deleted the AVDs and recreated them. Also I noticed that my app had reference to android ver 4.3 whereas the intel atom image was not available for that version. hence I downgraded it to 4.2.2. With these changes done, the app started loading normally. Not really what was the root cause, but something to do with the AVD was the issue.

Android "Application is not found on your phone" from launcher ..?

When I launch my application from eclipse (run), It starts up on my phone or emulator, working... This also puts the app in the appdrawer, however, when I press it it says: "Application is not installed on your phone". This is not because it's just an empty shortcut on my homescreen, it actually shows up in the drawer. I tried removing and reinstalling it, but that didn't help either.
Atached is my AndroidManifest.xml since I suspect the problem coming from there.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.application.package"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="#drawable/icon" android:label="#string/app_name" android:permission="android.permission.INTERNET">
<activity android:name=".UserInteraction" android:permission="android.permission.INTERNET"
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=".WebViewClass"
android:label="#string/app_name"/>
</application>
</manifest>
#MByD is spot on, but it's not just "not needed" but "actively causing you problems". Get rid of the android:permission attributes. You are saying that the launcher has to hold the INTERNET permission to launch your app, and the launcher probably does not have that permission.

How to call correctly run few class (intents)?

I'm beginner in Java Android developing. I'm using Eclipse SDK 3.6.1 version. I'm trying to do this thing: in first class (layout - main.xml) is button "hello", it calls new class (layout - second.xml), in this class are button "hello2", it calss new class. I can't do this cause when I push first button "hello" I getting this messages "The aplication (xxxx) has stopped unexpectedly. Please try again". How to resolve this problem. I think problem is in AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.kodinis_raktas"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".veiksmas"
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=".second" >
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".lock"></activity>
<intent-filter>
</intent-filter>
</application>
<uses-permission android:name="android.permission.SEND_SMS">
</uses-permission>
<uses-permission android:name="android.permission.RECEIVE_SMS">
</uses-permission>
<uses-sdk android:minSdkVersion="3" />
</manifest>
Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your error. That will give you more information.
I would recommend getting rid of the <intent-filter> elements from .second and .lock, since you are not using them. If your error is coming from trying to start .second, the existence of your category-only <intent-filter> may well prevent that activity from being started.
In my limited experience with android I think you need to add this line after activity android:name=".second"
android:label="#string/app_name">

Categories

Resources