Unable to instantiate application - AndroidManifest settings - android

We have recently developed an Android app and published it via Google Play. First of all we created a beta test group, added members to it and got feedback etc from each and everyone of them. We had no problems publishing and installing this beta version on the users devices.
We promoted this beta version (API level 14+) to production and suddenly the app started to fail after installing with the following error:
java.lang.RuntimeException: Unable to instantiate application x.x.x.App:
java.lang.ClassNotFoundException: x.x.x.App
In the AndroidManifest file the name attribute of Application was the full packagename x.x.x.App. We changed this to be just the class name App and everything started to work smoothly.
However the customer decided to make the app compatible with API 10 - 13 and we made the changes to AndroidManifest file accordingly. We just changed the minSDK=10. Again we had the beta testing process with no further errors etc.
We then decided to promote this app to production and now we get the same error
java.lang.RuntimeException: Unable to instantiate application x.x.x.App:
java.lang.ClassNotFoundException: x.x.x.App
again when installing/upgrading to this new version.
What on earth is going on here - I need an explanation (if it exists) since I am not able to find any meaning of this?
EDIT: The manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.expatindenmark.adquota"
android:versionCode="8"
android:versionName="3.2" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name="App"
android:allowBackup="false"
android:icon="#drawable/ic_launcher_hoejtid_ikon"
android:label="#string/app_name" >
<activity
android:name="com.expatindenmark.adquota.SplashActivity"
android:configChanges="locale"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.expatindenmark.adquota.AdquotaTabActivity"
android:configChanges="locale"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.NoTitleBar" >
</activity>
</application>
</manifest>

As stated in an earlier comment I changed name = "App" to name = ".App" and that works.

Related

implementing Ubers usebutton sdk and AndroidManifest.xml

I am trying to use the Uber usebutton but each time, it crashes giving the following error:
Unable to find explicit activity class {com.heyjude.heyjudeapp/com.usebutton.sdk.internal.GroupedInventoryCardActivity}; have you declared this activity in your AndroidManifest.xml?
I am unsure what to put in the AndroidManifest, currently as per the docs I have:
<meta-data
android:name="com.usebutton.applicationid"
android:value="app-myId" />
But it's clearly not working...
I have some more information, I checked the manifest-merger-debug-report.txt and found the following line
REJECTED from [com.usebutton:android-sdk:5.0.1] /Users/adamkatz/Projects/LavaLamp/Hey Jude/heyjudestudio/app/build/intermediates/exploded-aar/com.usebutton/android-sdk/5.0.1/AndroidManifest.xml:13:5-43:19
Why would the library manifest be rejected and how to make it accepted?
The maifest stuff maybe a red herring, your probably missing a library (The Uber library).
Here's a typical (working) AndroidMainfest.xml.
VERY important:
package="com.example.html2pdf"
replace with your package name (it's normally in your (local package) GroupedInventoryCardActivity.java file).
VERY important: Html2pdfActivity"
replace with one entry for activity for all your Activity files .GroupedInventoryCardActivity in your case (full path best package plus activity with dots (full stop's separating things, normally no slashes).
VERY VERY important:
com.heyjude.heyjudeapp/com.usebutton.sdk.internal.GroupedInventoryCardActivity is reffering to a library Activity (also with a package name the forward slash links the two packages). That's o.k.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.html2pdf"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.html2pdf.Html2pdfActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
So package (replace/change):
package="com.heyjude.heyjudeapp"
and (replace/change/insert) Activity (name):
<activity
android:name="com.heyjude.heyjudeapp/com.usebutton.sdk.internal.GroupedInventoryCardActivity"
Hope this helps and not make it more confusing ;O)
All that goes into the AndroidManifest.xml file is this:
<application
<activity
<!-- your activities -->
</activity>
<!--Button SDK-->
<meta-data android:name="com.usebutton.applicationid" android:value="YOUR_BUTTON_APP_ID"/>
</application>
Did you remember to replace "YOUR_BUTTON_APP_ID" with your Button app ID found in the dashboard?

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>

Android: Publishing an App in Google Play

I have developped an applicaction that basically download a file from a Server via Bluetooth and store it in the memory of the mobile phone.
I read what is needed to publish and application in http://developer.android.com/tools/publishing/publishing_overview.html
and I followed the steps:
Remove any "android:debuggable" in the Android Manifest.
Remove any Log calls
Sign the file: Right click on the project->Export -> Android ->
Export Android Application ... during the process I use an
AppKey.keystored that I created before.
I apply Zipalign
http://developer.android.com/tools/publishing/app-signing.html#signing-manually
Once I finish that I upload the App to the Google Play Store.
I downloaded it with three diferent devices, with the following version of Android:
4.2.2 (It is the one I used to develop, debbug and test the App while writting it on Eclipse)
4.3
4.4
But it only works properly in the device with 4.2.2. In the other two devices the Application crash when I launch it.
This is the Android manifest of the Application, all the code is too long to upload it here. But I feel there problem must be or in the manifest or in the way I'm exporting/signing the file.apk
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cliente_bluetooth"
android:versionCode="3"
android:versionName="1.3" >
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.cliente_bluetooth.Cliente_Bluetooth"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
This is the link of the App in the Play Store:
https://play.google.com/store/apps/details?id=com.cliente_bluetooth
Can anyone find a mistake in the process of publishing? am I skipping or missunderstanding any step?
Thank you very much for your time

android application resetting to older version

I have made an app which is pre-installed on android device of particular manufacturer. After this I have release an upgrade of application for example initial version 1.0.0.0 to upgrade version of 1.2.0.0. After upgrading the app if user restarts its phone then my application goes to the initial version of 1.0.0.0.
Don't know why this is happening ? Is there a problem in bundling the application to devices ?
Note: I am updating my app via my server and not from play store and this issue is reproducible only when app is pre-installed on devices.
In mainfest file of both the versions I forgot to change android:versionCode value, in both the versions android:versionCode=3. Is it creating problem because of this?
I have also changed the package name of Application class so is this is creating the problem ?
Manifest for first version:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.apps.spinr"
android:versionCode="1"
android:versionName="1.0.0.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="11" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#style/SpinrTheme"
android:name="com.abc.xyz.GDApplication">
<activity
android:name=".SplashActivity"
android:label="#string/title_activity_splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Mainfest for second version:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.apps.spinr"
android:versionCode="1"
android:versionName="1.2.0.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="11" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#style/SpinrTheme"
android:name="com.xxx.apps.GDApplication">
<activity
android:name=".SplashActivity"
android:label="#string/title_activity_splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Thanks for the suggestion. As #Mahmoud in comment suggested that "google play never release update for the app with the same version code", so I incremented version code of app and it worked fine. #Rat-a-tat-a-tat Ratatouille as I said in question I am not updating my app via google play neither my app is on play store so I was not able to figure this out initially. Anyways thanks for help.
So conclusion is
whenever you want to send upgrade of app always increase version code
of the app

Can't install APK correctly on device

I have built & sign my apk by Eclipse ADT as it is describes (export and sign by creating a new key). But it can't be install on real device while an errors occurs, such as "installer package error". I have no Android device & sent my apk to friends by email. I'm using AVD and everyth is fine with it. Any suggestions? Thanx guys.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.XXXX.YYYY"
android:versionCode="0"
android:versionName="0.9.2" android:installLocation="internalOnly">
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:hardwareAccelerated="true"
android:permission="android.permission.INTERNET"
android:allowBackup="true">
<activity
android:name="com.XXXX.YYYY.ActivityMain"
android:label="#string/main_activity_title"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.XXXX.YYYY.ActivityDetails"
android:parentActivityName="com.XXXX.YYYY.ActivityMain"
android:excludeFromRecents="true"
android:configChanges="orientation|screenSize">
</activity>
</application></manifest>
UPD: apk installs good, but the error occurs if choose Open (see screenshot). After that app works fine. But on tablet if try open app it says "App deleted".
UPD2: add supporting API 4+ meta tag for the 2nd activity, but it takes no effect
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.XXXX.YYYY.ActivityMain" />
You probably need to make sure your device and your friend's devices can install apps that are not from the play store.
This is a feature you have to specifically set, or else apps that are outside the play store will not install.
Here is how to set it:
Open settings
Find the Security settings (Pre 4.0 it is under Applications)
Look for a setting that says Unknown sources, or non-market apps
Enable that setting
Everything should work after that!
Here is an article with pictures if you are still confused :)
Your example was missing the closing </manifest> and android:enabled. I'm not sure if the latter would prevent a device from fully installing it but the first one would.
I've also had issues using the full activity names in the past, so you may want to try using simplifying them to see if it helps.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.XXXX.YYYY"
android:versionCode="0"
android:versionName="0.9.2" android:installLocation="internalOnly">
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:hardwareAccelerated="true"
android:allowBackup="true">
<activity
android:name=".ActivityMain"
android:label="#string/main_activity_title"
android:enabled="true"
android:permission="android.permission.INTERNET"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ActivityDetails"
android:parentActivityName=".ActivityMain"
android:excludeFromRecents="true"
android:configChanges="orientation|screenSize">
</activity>
</application>
</manifest>
Is "Unknown sources" option under "security" allowed on device?
My problem was a duplicate internet permission request on Manifest! When I remove that from activity app was run normally.

Categories

Resources