Log in or register to post comments

Main Activity "classnotfoundexception" from Google Play

September 4, 2013 - 6:49am #1

Hi there,

I've built and published an Alpha into the Android store.  The Debug versions and Release versions work just fine when publishing directly from unity but I've uploaded the .pak and .obb files to Google Play, tried downloading it and got this:

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{xx.xxxxxxxxxx.xxxxxxxxx/xx.xxxxxxxxxx.xxxxxxxxx.QCARJavaActivity}: java.lang.ClassNotFoundException: xx.xxxxxxxxxx.xxxxxxxxx.QCARJavaActivity

I'm really stumped.  Everything I've read indicates a possible Android Manifest file issue, like forgetting to add the main activity or using an imporper path.

Here's the Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest 	xmlns:android="http://schemas.android.com/apk/res/android" 
	<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="17" />
 	<permission android:name="xx.xxxxxxxxxx.xxxxxxxxx.permission.MAPS_RECEIVE" android:protectionLevel="signature" />
  	  <uses-permission android:name="android.permission.WAKE_LOCK" />
  <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  <uses-permission android:name="android.permission.CAMERA" />
  <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  	<uses-permission android:name="xx.xxxxxxxxxx.xxxxxxxxx.permission.MAPS_RECEIVE" />
 	<uses-permission android:name="android.permission.INTERNET"/>
	<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"/>
<!-- The following two permissions are not required to use
     Google Maps Android API v2, but are recommended. -->
	<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
	<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
  	<uses-feature android:glEsVersion="0x00020000" />
  	<uses-feature android:name="android.hardware.camera" />
    <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  	<application android:label="@string/app_name" android:allowBackup="true" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:debuggable="false">
        <uses-library android:name="com.google.android.maps" android:required="false" /> 
        <meta-data android:name="com.google.android.maps.v2.API_KEY"
            android:value="XXXXXXXXXXXXXXXXXXXXXXXXX" />
      	    <activity android:name=".QCARJavaActivity" android:label="@string/app_name" android:screenOrientation="portrait" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    <activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerActivity" android:label="@string/app_name" android:screenOrientation="portrait" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    <activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity" android:label="@string/app_name" android:screenOrientation="portrait" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
      <meta-data android:name="android.app.lib_name" android:value="unity" />
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
    <activity android:name="com.unity3d.player.VideoPlayer" android:label="@string/app_name" android:screenOrientation="portrait" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">

Everything looks to be correct (XXX's are added just now).

When declaring my activity:

public class QCARJavaActivity extends QCARPlayerActivity implements LocationListener {

It's public, it matches the name in the manifest, it's On Create Method is set up properly:

    public void onCreate(Bundle savedInstanceState) {


I'm just not sure where else to look.  I'd setup my eclipse environment properly for sdk 16 (4.1.2).  I've checked that In Java Build Path>Order and Export, that the QCAR, QCARUnityPlayer, and Classes JARS are all added and checked.  Google PlayServices Lib has been added to the Library in Properties/Android.  The Android Library part of the Eclipse/adt project isLibrary (true) in Properties/Android.  The Stack trace doesn't reference an external SD card path (so it's unclear if that could still be an issue).  

The Jar builds without any issues, It's added to the Unity Assets/Plugins/Android folder, it's referencing all of the Drawables properly, building from Unity to a device directly always works, my maps appear QCAR works (most of the time, there still seems to be a Camera Services Connection refused bug which is driving me crazy).

What else could I possibly be missing??????  If anyone would like to be added as an alpha tester for this app, PM me your google email address and I'll add you to the beta test group.

Thanks in advance.  I'll be shamelessly posting this at the Unity site and Stack Overflow too.  Maybe I'm doing something obviously stupid.

Main Activity "classnotfoundexception" from Google Play

September 5, 2013 - 11:52pm #4

Ok, glad to hear that in the end you solved it.


Main Activity "classnotfoundexception" from Google Play

September 5, 2013 - 2:04pm #3

Thank you again, so much for your reply, but it turns out, I did it all correctly (not to be conceited), it was a corrupt .apk in the store.  I realized the file size differed from the unity build.  

Nearly lost my tiny little mind on this one.  I wiped out everything, re-signed, even created a new google maps API key, and the new version I just pushed to the store worked.

Thanks for your help.

Main Activity "classnotfoundexception" from Google Play

September 4, 2013 - 7:13am #2

Hi, everything appeas correct in your Manifest. But the problem could be in some missing jars or libs.

Have you tried checking the approach proposed in this link ? this could give you some extra hints:


Also: you may want to try to use the fully qualified activity name (i.e. com.example.MyActivity instead of just .MyActivity)


Log in or register to post comments