Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello everyone,

I am very new to phonegap (mobile apps), i was trying out and simple alert message app which displays "HELLO" on device ready in phonegap, but everytime I run the app it shows me Unfortunately, app has stopped.

I have searched and tried a lot resolving this but couldn't, i have config.xml in my res/xml folder, also my android.manifest file is updated with proper permissions

Manifest file :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.pg"
    android:versionCode="1"
    android:versionName="1.0" >

     <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:resizeable="true"
        android:smallScreens="true"
        />

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <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_LOCATION_EXTRA_COMMANDS" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.RECORD_VIDEO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.BROADCAST_STICKY" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
    
    
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        >
        <activity
            android:name="com.example.pg"
            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>

Config file :

<?xml version="1.0" encoding="utf-8"?>
<!--
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
-->
<cordova>
    <!--
    access elements control the Android whitelist.
    Domains are assumed blocked unless set otherwise
     -->
     <content src="index.html" />

    <access origin="http://127.0.0.1*"/> <!-- allow local pages -->

    <access origin="https://app47.com" subdomains="true"/>
    <access origin="http://app47.mobi/" subdomains="true"/>
    <access origin="https://app47.mobi/" subdomains="true"/>
    
    <!-- <access origin="https://example.com" subdomains="true" /> such as above, but including subdomains, such as www -->
    <access origin=".*"/>

    <log level="DEBUG"/>
    <preference name="useBrowserHistory" value="true" />
    <preference name="exit-on-suspend" value="false" />
	<plugins>
	    <plugin name="App47" value="com.app47.pgplugin.App47PGPlugin" />
	    <plugin name="App" value="org.apache.cordova.App"/>
	    <plugin name="Geolocation" value="org.apache.cordova.GeoBroker"/>
	    <plugin name="Device" value="org.apache.cordova.Device"/>
	    <plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager"/>
	    <plugin name="Notification" value="org.apache.cordova.Notification"/>
	    <plugin name="Storage" value="org.apache.cordova.Storage"/>
	    <plugin name="Echo" value="org.apache.cordova.Echo" />
	    <plugin name="Globalization" value="org.apache.cordova.Globalization"/>
	    <plugin name="InAppBrowser" value="org.apache.cordova.InAppBrowser"/>
	</plugins>

</cordova>


And my log cat -
08-04 03:13:38.810: E/AndroidRuntime(1425): FATAL EXCEPTION: main
08-04 03:13:38.810: E/AndroidRuntime(1425): Process: com.example.pg, PID: 1425
08-04 03:13:38.810: E/AndroidRuntime(1425): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.pg/com.example.pg}: java.lang.ClassNotFoundException: Didn't find class "com.example.pg" on path: DexPathList[[zip file "/data/app/com.example.pg-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.pg-2, /system/lib]]
08-04 03:13:38.810: E/AndroidRuntime(1425): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
08-04 03:13:38.810: E/AndroidRuntime(1425): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
08-04 03:13:38.810: E/AndroidRuntime(1425): at android.app.ActivityThread.access$800(ActivityThread.java:135)
08-04 03:13:38.810: E/AndroidRuntime(1425): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
08-04 03:13:38.810: E/AndroidRuntime(1425): at android.os.Handler.dispatchMessage(Handler.java:102)
08-04 03:13:38.810: E/AndroidRuntime(1425): at android.os.Looper.loop(Looper.java:136)
08-04 03:13:38.810: E/AndroidRuntime(1425): at android.app.ActivityThread.main(ActivityThread.java:5001)
08-04 03:13:38.810: E/AndroidRuntime(1425): at java.lang.reflect.Method.invokeNative(Native Method)
08-04 03:13:38.810: E/AndroidRuntime(1425): at java.lang.reflect.Method.invoke(Method.java:515)
08-04 03:13:38.810: E/AndroidRuntime(1425): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
08-04 03:13:38.810: E/AndroidRuntime(1425): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
08-04 03:13:38.810: E/AndroidRuntime(1425): at dalvik.system.NativeStart.main(Native Method)
08-04 03:13:38.810: E/AndroidRuntime(1425): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.pg" on path: DexPathList[[zip file "/data/app/com.example.pg-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.pg-2, /system/lib]]
08-04 03:13:38.810: E/AndroidRuntime(1425): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
08-04 03:13:38.810: E/AndroidRuntime(1425): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
08-04 03:13:38.810: E/AndroidRuntime(1425): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
08-04 03:13:38.810: E/AndroidRuntime(1425): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
08-04 03:13:38.810: E/AndroidRuntime(1425): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2101)
08-04 03:13:38.810: E/AndroidRuntime(1425): ... 11 more



Please help me how to resolve this..

THanks.
Posted

1 solution

Start by looking at the error messages:
08-04 03:13:38.810: E/AndroidRuntime(1425): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.pg/com.example.pg}: java.lang.ClassNotFoundException: Didn't find class "com.example.pg" on path: DexPathList[[zip file "/data/app/com.example.pg-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.pg-2, /system/lib]]
Should give you a big clue!

Where is the com.example.pg class? Did you put it in the installer?
 
Share this answer
 
Comments
krunalpanchalN 4-Aug-15 5:08am    
Hi,

Thanks for the repsonse, if it is to be included in manifest file then it is already there, can you please help me where else should i put this ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900