Signed android app crashes - android

I'm tying to publish my app on the market. But after i sign my apk and install it i get a crash before it even loads an activity. I've located the following error in the logCat
03-24 14:57:03.080: E/AndroidRuntime(4310): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.golfboxdk/com.golfboxdk.LoginActivity}:
java.lang.ClassNotFoundException: Didn't find class "com.golfboxdk.LoginActivity" on path: DexPathList[[zip file "/data/app/com.golfboxdk-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.golfboxdk-1, /vendor/lib, /system/lib]]
I've checked my manifest and i really cant figure out whats wrong. My app runs smoothly when I'm using an unsigned apk.
This is the start of my manifest
package="com.golfboxdk"
android:versionCode="5"
android:versionName="1.7.2" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:name="com.golfboxdk.utils.GolfBoxApplication"
android:allowBackup="false"
android:icon="#drawable/app_icon"
android:killAfterRestore="true"
android:label="#string/app_name"
android:theme="#android:style/Theme.Light.NoTitleBar" >
<activity
android:name="com.golfboxdk.LoginActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Things i already tried:
Enabling all files under ->Project->Properties->java Build path->Order and Expert, followed with a clean.
Check if ProGuard is activated (it's not)

Try the following:
Project > Uncheck build automatically
Clean the workspace
Manually build your project
Sign your apk and send it to device via bluetooth/wifi/email, etc.
Test it and release it if it works

I have had this issue before with Eclipse/ADT. Sometimes it just doesn't seem to package up the APK correctly.
Typically a clean and build followed by exporting the signed APK again fixes it for me.

No one said that there would be a problem with proguard, but only this solved my issue.

Related

Tag manifest attribute package has invalid character '_' even after removing said character

I am working in Android 2.3.3, and have run into this error: "Tag manifest attribute package has invalid character'_'. Initially, I was getting this error because my package name contained an underscore (com.isco_pipe.www.fieldtechapp). I have since renamed the package and removed the underscore (as you can see in the manifest file below). But the error persists upon an attempt to rebuild. Any thoughts?
Here is my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.iscopipe.www.fieldtechapp">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application android:allowBackup="true" android:icon="#mipmap/ic_launcher"
android:label="#string/app_name" android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true" android:theme="#style/AppTheme">
<activity android:name="com.iscopipe.www.fieldtechapp.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Note: I previously asked a question about not being able to debug my app on my device (running Android Studio on a virtual machine). I am now attempting to setup and run my app in Android Studio directly on my Windows laptop to see if I can run the app on an emulator and debug from there. Unable to attach debugger to Android process in Android Studio 2.3.3
Check your build.gradle file also, what you gave in applicationId.
Make sure that you are editing the proper file. Android Studio has the absolutely aggravating "feature" where certain errors cause a file in build/ to pop up in the editor. In your case, it would be a merged manifest, not your actual manifest. Editing files in build/ will have no effect, as they get re-created on each build. So, make sure that you have modified your actual manifest (e.g., src/main/AndroidManifest.xml).

Google play Key in manifest made a lot of errors and red exclamation mark

So i followed this guide https://developers.google.com/maps/documentation/android-api/signup
and created a new Google Developer Console project in here
https://console.developers.google.com/home
I put my Eclipse project package name and got the Google Key.
Now as the guide said i added this to my manifest
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY"/>
and after i did that i have got a lot of errors in my project and there's also an red exclamation mark near all of my projects of this workspace.
So what I'm doing wrong? I just want to start develop using google play. And please, i read all the guides in their and eclipse's and i still can't get it to go.
EDIT
I think i might missed the google play services library. I cant find where to download it.
manifest: as requested.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.minyan.get.dl"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="23" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission
android:name="android.permission.INTERNET"/>
<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=".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=".MyLocation"
android:label="#string/title_activity_my_location" >
</activity>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCzVDpAckc5p3DGRIJsco-CyIiFfjgn--k />
</application>
</manifest>
Like in the guides the <meta data /> is in the application tag.
To make the Google Play services APIs available to your app:
Copy the library project at <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/ to the location where you maintain your Android app projects.
Import the library project into your Eclipse workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
After you've added the Google Play services library as a dependency for your app project, open your app's manifest file and add the following tag as a child of the <application> element:
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Basically google play services library is not needed to download, it resides in your SDK only
and here is the path, you can find the library
.../sdk/extras/google/google_play_services/libproject/google-play-services_lib
I think the following could solve your problem:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCzVDpAckc5p3DGRIJsco-CyIiFfjgn--k" />
^
!

java.lang.ClassNotFoundException: Didn't find class *.*.MainActivity with newrelic

I'm creating a kind of complex app that has multiple dependencies, I was using newrelic for a while with no problems, after that I wanted to add ZenDesk to the app, but when initializing the SDK , I was receiving a new relic error which was too weird! I tried for the sake of testing to remove newrelic from the app completely, so I removed compile 'com.newrelic.agent.android:android-agent:5.3.1' from the gradle file
the app doesn't work at all now! it crashes on start showing the error in the title:
java.lang.ClassNotFoundException: Didn't find class *.*.MainActivity
when I add the newrelic back the app starts to work again!
I tried to to some digging about the problem and I found few suggestions about stopping gradle and cleaning the project and so saying the problem is probably a gradle cash or so, I tried everything, I even tried it on another machine, the problem persisted !
any ideas what is wrong??
EDIT:
manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:supportsRtl="true">
<activity
android:name="com.myapp.Main.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="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
</application>
</manifest>
android:name="com.myapp.Main.MainActivity"
I guess it is wrong
It will
android:name="com.orderme.MainActivity"
The ClassNotFoundException is thrown when the Java Virtual Machine
(JVM) tries to load a particular class and the specified class cannot
be found in the classpath. The ClassNotFoundException is a checked
exception and thus, must be declared in a method or constructor’s
throws clause.
What is the way
Verify that the name of the requested class is correct and that the
appropriate .jar file exists in your classpath. If not, you must
explicitly add it to your application’s classpath.
In case the specified .jar file exists in your classpath then, your
application’s classpath is getting overriden and you must find the
exact classpath used by your application.
In case the exception is caused by a third party class, you must
identify the class that throws the exception and then, add the
missing .jar files in your classpath.
Eclipse - java.lang.ClassNotFoundException
As always, the solution is 99% stupid when it comes to programming XD
at the top of my gradle file there was this:
apply plugin: 'newrelic'
I just removed this line and it works now .

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

Unable to instantiate application - AndroidManifest settings

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.

Categories

Resources