Recently, I have updated Android SDK with Latest Tools(Rev. 17). I am using Pahonegap 1.3.0
When I am loading page, I am not getting anything on emulator and got the below error
> 04-02 18:49:31.312: W/dalvikvm(1689): Unable to resolve superclass of
> Lcom/src/test1/Test1Activity; (4) 04-02 18:49:31.362:
> W/dalvikvm(1689): Link of class 'Lcom/src/test1/Test1Activity;' failed
> 04-02 18:49:31.362: D/AndroidRuntime(1689): Shutting down VM 04-02
> 18:49:31.402: W/dalvikvm(1689): threadid=1: thread exiting with
> uncaught exception (group=0x409c01f8) 04-02 18:49:31.522:
> E/AndroidRuntime(1689): FATAL EXCEPTION: main 04-02 18:49:31.522:
> E/AndroidRuntime(1689): java.lang.RuntimeException: Unable to
> instantiate activity
> ComponentInfo{com.src.test1/com.src.test1.Test1Activity}:
> java.lang.ClassNotFoundException: com.src.test1.Test1Activity 04-02
> 18:49:31.522: E/AndroidRuntime(1689): at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
> 04-02 18:49:31.522: E/AndroidRuntime(1689): at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
> 04-02 18:49:31.522: E/AndroidRuntime(1689): at
> android.app.ActivityThread.access$600(ActivityThread.java:123) 04-02
> 18:49:31.522: E/AndroidRuntime(1689): at
> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
> 04-02 18:49:31.522: E/AndroidRuntime(1689): at
> android.os.Handler.dispatchMessage(Handler.java:99) 04-02
> 18:49:31.522: E/AndroidRuntime(1689): at
> android.os.Looper.loop(Looper.java:137) 04-02 18:49:31.522:
> E/AndroidRuntime(1689): at
> android.app.ActivityThread.main(ActivityThread.java:4424) 04-02
> 18:49:31.522: E/AndroidRuntime(1689): at
> java.lang.reflect.Method.invokeNative(Native Method) 04-02
> 18:49:31.522: E/AndroidRuntime(1689): at
> java.lang.reflect.Method.invoke(Method.java:511) 04-02 18:49:31.522:
> E/AndroidRuntime(1689): at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
> 04-02 18:49:31.522: E/AndroidRuntime(1689): at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 04-02
> 18:49:31.522: E/AndroidRuntime(1689): at
> dalvik.system.NativeStart.main(Native Method) 04-02 18:49:31.522:
> E/AndroidRuntime(1689): Caused by: java.lang.ClassNotFoundException:
> com.src.test1.Test1Activity 04-02 18:49:31.522:
> E/AndroidRuntime(1689): at
> dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
> 04-02 18:49:31.522: E/AndroidRuntime(1689): at
> java.lang.ClassLoader.loadClass(ClassLoader.java:501) 04-02
> 18:49:31.522: E/AndroidRuntime(1689): at
> java.lang.ClassLoader.loadClass(ClassLoader.java:461) 04-02
> 18:49:31.522: E/AndroidRuntime(1689): at
> android.app.Instrumentation.newActivity(Instrumentation.java:1023)
> 04-02 18:49:31.522: E/AndroidRuntime(1689): at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
> 04-02 18:49:31.522: E/AndroidRuntime(1689): ... 11 more
You are getting a class not found exception :
java.lang.ClassNotFoundException: com.src.test1.Test1Activity
It's not bundle in your apk, or obfuscated, or not in your manifest.
I just had the same issue. My problem was that the name of the file and class in the source folder did not match package name in manifest.
I solved this by adding a new class with the correct name.
1: Figure out your package: com.apps.sampleApp
Note the name of the end class, in this case sampleApp
2: In source make sure that three is sampleApp.java in src/com.apps.sampleApp
IF YES
make sure the public class is sampleApp
IF NO
There is another file here that extends DroidGap. Copy this to sampleApp.java and change the public class name to sampleApp
Hope that helps others, it solved the issue for me.
Related
I have tried a small example in Google map. I have got the API key but when I run the project, it displays the following errors. I have also imported Google play services.
My XML file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
My Java
package com.arun.maps;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.widget.Toast;
public class GoogleMapS extends FragmentActivity {
private GoogleMap googleMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.google_map);
try {
// Loading map
initilizeMap();
} catch (Exception e) {
e.printStackTrace();
}
}
private void initilizeMap() {
if (googleMap == null) {
googleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(
R.id.map)).getMap();
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
}
#Override
protected void onResume() {
super.onResume();
initilizeMap();
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.google_map, menu);
return true;
}
}
Android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.arun.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required OpenGL ES 2.0. for Maps V2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name="com.arun.maps.GoogleMapS"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="
AIzaSyBn3b2eGABl1JL-xXKe1H_uf4UtPRUUAwY" />
</application>
</manifest>
Error:
04-02 17:21:39.355: E/AndroidRuntime(719): FATAL EXCEPTION: main
04-02 17:21:39.355: E/AndroidRuntime(719): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.arun.maps/com.arun.maps.GoogleMapS}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.os.Looper.loop(Looper.java:130)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-02 17:21:39.355: E/AndroidRuntime(719): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 17:21:39.355: E/AndroidRuntime(719): at java.lang.reflect.Method.invoke(Method.java:507)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-02 17:21:39.355: E/AndroidRuntime(719): at dalvik.system.NativeStart.main(Native Method)
04-02 17:21:39.355: E/AndroidRuntime(719): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
04-02 17:21:39.355: E/AndroidRuntime(719): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.Activity.setContentView(Activity.java:1657)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.arun.maps.GoogleMapS.onCreate(GoogleMapS.java:16)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-02 17:21:39.355: E/AndroidRuntime(719): ... 11 more
04-02 17:21:39.355: E/AndroidRuntime(719): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4323000 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.common.GooglePlayServicesUtil.t(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.maps.internal.q.B(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.maps.internal.q.A(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.maps.SupportMapFragment$b.gW(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.dynamic.a.a(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:290)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
04-02 17:21:39.355: E/AndroidRuntime(719): ... 20 more
Add this in manifest file's application tag.
<!-- Required after latest Google Play Services update -->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Add this in manifest file inside your application tag:
<meta-data
android:name="com.google.android.gms.version"
android:value="4242000" />
I have been following Googles guide to making an app that allows you to view an app on an Android phone. I have followed many tutorials, but always end up with the same error! I have also searched around the web and figured my error is something to do with the "fragment". Here are my files:
MainActivity.java
package com.example.theapp;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.theapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<permission
android:name="com.example.theapp.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.theapp.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"
android:required="true"/>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="--REMOVED--"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.theapp.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>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
I am using Android 2.3. Here is the log cat messages:
04-02 22:43:45.890: D/AndroidRuntime(23773): Shutting down VM
04-02 22:43:45.890: W/dalvikvm(23773): threadid=1: thread exiting with uncaught exception (group=0x40018578)
04-02 22:43:45.898: E/AndroidRuntime(23773): FATAL EXCEPTION: main
04-02 22:43:45.898: E/AndroidRuntime(23773): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.theapp/com.example.theapp.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.os.Looper.loop(Looper.java:130)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.ActivityThread.main(ActivityThread.java:3687)
04-02 22:43:45.898: E/AndroidRuntime(23773): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 22:43:45.898: E/AndroidRuntime(23773): at java.lang.reflect.Method.invoke(Method.java:507)
04-02 22:43:45.898: E/AndroidRuntime(23773): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
04-02 22:43:45.898: E/AndroidRuntime(23773): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
04-02 22:43:45.898: E/AndroidRuntime(23773): at dalvik.system.NativeStart.main(Native Method)
04-02 22:43:45.898: E/AndroidRuntime(23773): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-02 22:43:45.898: E/AndroidRuntime(23773): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:209)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.Activity.setContentView(Activity.java:1657)
04-02 22:43:45.898: E/AndroidRuntime(23773): at com.example.theapp.MainActivity.onCreate(MainActivity.java:11)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
04-02 22:43:45.898: E/AndroidRuntime(23773): ... 11 more
04-02 22:43:45.898: E/AndroidRuntime(23773): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader[/data/app/com.example.theapp-1.apk]
04-02 22:43:45.898: E/AndroidRuntime(23773): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
04-02 22:43:45.898: E/AndroidRuntime(23773): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
04-02 22:43:45.898: E/AndroidRuntime(23773): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.view.LayoutInflater.createView(LayoutInflater.java:471)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
04-02 22:43:45.898: E/AndroidRuntime(23773): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
04-02 22:43:45.898: E/AndroidRuntime(23773): ... 19 more
04-02 22:55:53.289: D/AndroidRuntime(23942): Shutting down VM
04-02 22:55:53.289: W/dalvikvm(23942): threadid=1: thread exiting with uncaught exception (group=0x40018578)
04-02 22:55:53.304: E/AndroidRuntime(23942): FATAL EXCEPTION: main
04-02 22:55:53.304: E/AndroidRuntime(23942): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.theapp/com.example.theapp.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.os.Looper.loop(Looper.java:130)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.ActivityThread.main(ActivityThread.java:3687)
04-02 22:55:53.304: E/AndroidRuntime(23942): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 22:55:53.304: E/AndroidRuntime(23942): at java.lang.reflect.Method.invoke(Method.java:507)
04-02 22:55:53.304: E/AndroidRuntime(23942): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
04-02 22:55:53.304: E/AndroidRuntime(23942): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
04-02 22:55:53.304: E/AndroidRuntime(23942): at dalvik.system.NativeStart.main(Native Method)
04-02 22:55:53.304: E/AndroidRuntime(23942): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-02 22:55:53.304: E/AndroidRuntime(23942): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:209)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.Activity.setContentView(Activity.java:1657)
04-02 22:55:53.304: E/AndroidRuntime(23942): at com.example.theapp.MainActivity.onCreate(MainActivity.java:11)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
04-02 22:55:53.304: E/AndroidRuntime(23942): ... 11 more
04-02 22:55:53.304: E/AndroidRuntime(23942): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader[/data/app/com.example.theapp-2.apk]
04-02 22:55:53.304: E/AndroidRuntime(23942): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
04-02 22:55:53.304: E/AndroidRuntime(23942): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
04-02 22:55:53.304: E/AndroidRuntime(23942): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.view.LayoutInflater.createView(LayoutInflater.java:471)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
04-02 22:55:53.304: E/AndroidRuntime(23942): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
04-02 22:55:53.304: E/AndroidRuntime(23942): ... 19 more
Any help would be appreciated. Thank you in advance.
package com.example.theapp;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
and in manifest add one more meta tag below previous one.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="Api key" />
As far as I remember, You should include android-support-v4.jar file from Android SDK folder "sdk/extras/android/support/v4/android-support-v4.jar". If You dont have that file, in Your SDK Manager install Android Support Library, which is found under Extras.
Please check the following steps:
In android manifest you have the NETWORK STATE permission like this
< uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
In android manifest make sure you have the following code as well-
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value=" YOUR KEY HERE" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Lastly if you are testing your application on android API 5.x then make sure you modify your map code like this-
Instead of this
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
write this
map = getMapFragment().getMap();
and add a small method like this
private MapFragment getMapFragment() {
FragmentManager fm = null;
Log.d("", "sdk: " + Build.VERSION.SDK_INT);
Log.d("", "release: " + Build.VERSION.RELEASE);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
Log.d("", "using getFragmentManager");
fm = getFragmentManager();
} else {
Log.d("", "using getChildFragmentManager");
fm = getChildFragmentManager();
}
return (MapFragment) fm.findFragmentById(R.id.map);
}
And make sure for step 3 your min sdk version in your manifest file is 17 like this
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="21" />
My app will start if I don't take away the title bar but when I do it crashes as soon as it starts.
This is the code I have so far.
?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.v1.solitare"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name">
<activity
android:name="com.v1.solitare.MainActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Please help in any way possible. I just picked up Android coding with Eclipse today and I'm very new at it.
Edit: I think I found the LogCat Errors for it:
04-02 22:06:28.986: E/AndroidRuntime(28352): FATAL EXCEPTION: main
04-02 22:06:28.986: E/AndroidRuntime(28352): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.v1.solitare/com.v1.solitare.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2359)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.access$700(ActivityThread.java:165)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1326)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.os.Looper.loop(Looper.java:137)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.main(ActivityThread.java:5455)
04-02 22:06:28.986: E/AndroidRuntime(28352): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 22:06:28.986: E/AndroidRuntime(28352): at java.lang.reflect.Method.invoke(Method.java:525)
04-02 22:06:28.986: E/AndroidRuntime(28352): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
04-02 22:06:28.986: E/AndroidRuntime(28352): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
04-02 22:06:28.986: E/AndroidRuntime(28352): at dalvik.system.NativeStart.main(Native Method)
04-02 22:06:28.986: E/AndroidRuntime(28352): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:111)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
04-02 22:06:28.986: E/AndroidRuntime(28352): at com.v1.solitare.MainActivity.onCreate(MainActivity.java:18)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.Activity.performCreate(Activity.java:5372)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)
04-02 22:06:28.986: E/AndroidRuntime(28352): ... 11 more
ActionBarActivity assumes you are using an ActionBar, while Theme.NoTitleBar themes remove the ActionBar (as that is part of the title bar on newer devices and ActionBarActivity assumes you are using a Theme.AppCompat theme which controls styling for the ActionBar).
Change your activity to extend FragmentActivity if you are okay with not having an Action Bar, although as per the Android design docs is a critical component for making your app feel like an Android app (although some would say that games are granted more leeway).
I just download the ADT Bundle, update the eclipse plugin, update the extras and tools folder from the sdk, import google play services and google maps sample from the sdk I have this error
04-02 13:49:26.031: E/AndroidRuntime(11469): FATAL EXCEPTION: main
04-02 13:49:26.031: E/AndroidRuntime(11469): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mapdemo/com.example.mapdemo.BasicMapDemoActivity}: android.view.InflateException: Binary XML file line #18: Error inflating class fragment
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.ActivityThread.access$600(ActivityThread.java:140)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.os.Looper.loop(Looper.java:137)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.ActivityThread.main(ActivityThread.java:4895)
04-02 13:49:26.031: E/AndroidRuntime(11469): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 13:49:26.031: E/AndroidRuntime(11469): at java.lang.reflect.Method.invoke(Method.java:511)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
04-02 13:49:26.031: E/AndroidRuntime(11469): at dalvik.system.NativeStart.main(Native Method)
04-02 13:49:26.031: E/AndroidRuntime(11469): Caused by: android.view.InflateException: Binary XML file line #18: Error inflating class fragment
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:306)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.Activity.setContentView(Activity.java:1912)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.example.mapdemo.BasicMapDemoActivity.onCreate(BasicMapDemoActivity.java:42)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.Activity.performCreate(Activity.java:5163)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
04-02 13:49:26.031: E/AndroidRuntime(11469): ... 11 more
04-02 13:49:26.031: E/AndroidRuntime(11469): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/maps_popup_pointer_button.xml from drawable resource ID #0x7f0201b7
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.content.res.Resources.loadDrawable(Resources.java:1951)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.content.res.Resources.getDrawable(Resources.java:672)
04-02 13:49:26.031: E/AndroidRuntime(11469): at maps.e.bm.a(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at maps.e.al.a(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at maps.e.bh.a(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at maps.e.bg.a(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at etu.onTransact(SourceFile:107)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.os.Binder.transact(Binder.java:326)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.google.android.gms.maps.SupportMapFragment$a.onCreateView(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.google.android.gms.dynamic.a$4.b(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.google.android.gms.dynamic.a.a(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.google.android.gms.dynamic.a.onCreateView(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:900)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1184)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
04-02 13:49:26.031: E/AndroidRuntime(11469): ... 20 more
04-02 13:49:26.031: E/AndroidRuntime(11469): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/maps_popup_pointer_button.xml from xml type drawable resource ID #0x7f0201b7
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2178)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.content.res.Resources.loadDrawable(Resources.java:1946)
04-02 13:49:26.031: E/AndroidRuntime(11469): ... 39 more
04-02 13:49:26.031: E/AndroidRuntime(11469): Caused by: java.io.FileNotFoundException: res/drawable/maps_popup_pointer_button.xml
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.content.res.AssetManager.openXmlAssetNative(Native Method)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:487)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2160)
04-02 13:49:26.031: E/AndroidRuntime(11469): ... 40 more
04-02 13:49:26.062: E/android.os.Debug(307): !#Dumpstate > dumpstate -k -t -z -d -o /data/log/dumpstate_app_error
Some folder from the proyect and lib configuration
https://www.dropbox.com/sh/12sksspx5a42bnq/lNUKGtsUgI#/
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapdemo"
android:versionCode="6"
android:versionName="2.7.0">
<!-- Copied from Google Maps Library/AndroidManifest.xml. -->
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- External storage for caching. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- My Location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- Maps API needs OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<!-- End of copy. -->
<application
android:icon="#drawable/ic_launcher"
android:label="#string/demo_title"
android:hardwareAccelerated="true">
<!-- ** You need to replace the key below with your own key. **
The example key below will not be accepted because it is not linked to the
certificate which you will use to sign this application.
See: https://developers.google.com/maps/documentation/android/start
for instructions on how to get your own key. -->
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCvGBr5in13NK2********Ttnxj3mrXQy4"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".LegalInfoActivity"
android:label="#string/legal_info"/>
<activity
android:name=".BasicMapDemoActivity"
android:label="#string/basic_map_demo_label"/>
<activity
android:name=".CameraDemoActivity"
android:label="#string/camera_demo_label"/>
<activity
android:name=".CircleDemoActivity"
android:label="#string/circle_demo_label"/>
<activity
android:name=".EventsDemoActivity"
android:label="#string/events_demo_label"/>
<activity
android:name=".GroundOverlayDemoActivity"
android:label="#string/ground_overlay_demo_label"/>
<activity
android:name=".LayersDemoActivity"
android:label="#string/layers_demo_label"/>
<activity
android:name=".LocationSourceDemoActivity"
android:label="#string/location_source_demo_label"/>
<activity
android:name=".MapInPagerDemoActivity"
android:label="#string/map_in_pager_demo_label"/>
<activity
android:name=".MarkerDemoActivity"
android:label="#string/marker_demo_label"/>
<activity
android:name=".MultiMapDemoActivity"
android:label="#string/multi_map_demo_label"/>
<activity
android:name=".MyLocationDemoActivity"
android:label="#string/my_location_demo_label"/>
<activity
android:name=".OptionsDemoActivity"
android:label="#string/options_demo_label"/>
<activity
android:name=".PolygonDemoActivity"
android:label="#string/polygon_demo_label"/>
<activity
android:name=".PolylineDemoActivity"
android:label="#string/polyline_demo_label"/>
<activity
android:name=".ProgrammaticDemoActivity"
android:label="#string/programmatic_demo_label"/>
<activity
android:name=".RawMapViewDemoActivity"
android:label="#string/raw_map_view_demo_label"/>
<activity
android:name=".RetainMapDemoActivity"
android:label="#string/retain_map_demo_label"/>
<activity
android:name=".SaveStateDemoActivity"
android:label="#string/save_state_demo_label"/>
<activity
android:name=".SnapshotDemoActivity"
android:label="#string/snapshot_demo_label"/>
<activity
android:name=".TileCoordinateDemoActivity"
android:label="#string/tile_coordinate_demo_label"/>
<activity
android:name=".TileOverlayDemoActivity"
android:label="#string/tile_overlay_demo_label"/>
<activity
android:name=".UiSettingsDemoActivity"
android:label="#string/ui_settings_demo_label"/>
<activity
android:name=".VisibleRegionDemoActivity"
android:label="#string/visible_region_demo_label"/>
</application>
</manifest>
the layout
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012 The Android Open Source Project
Licensed 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.
-->
<!-- This can go anywhere in your layout (see other demos for some examples). -->
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
If a create the map via Java like this
mapaVirtual = SupportMapFragment.newInstance();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(R.id.map, mapaVirtual, "TAG");
ft.commit();
mapaVirtual = new SupportMapFragment()
{
#Override
public void onActivityCreated(Bundle savedInstanceState)
{
super.onActivityCreated(savedInstanceState);
GoogleMap map = mapaVirtual.getMap();
if (map != null)
{
mapa = mapaVirtual.getMap();
mapa.setMyLocationEnabled(true);
mapa.setOnInfoWindowClickListener(new OnInfoWindowClickListener()
{
#Override
public void onInfoWindowClick(Marker marker)
{
}
});
mapa.setOnMarkerClickListener(new OnMarkerClickListener()
{
public boolean onMarkerClick(Marker marker)
{
return false;
}
});
}
}
};
Same error
UPDATE
Some testing
Samsung G3 - Mini with 4.1.2 Google Play services client version: 3159100 > Works
Samsung Galaxy Tab 2 7.0 with 4.1.1 Google Play services cliente version: 3159100 > Not works
I preinstalled app into /vendor/app, and lib into /vendor/lib. when I start app, exception caught:
> E/AndroidRuntime( 2446): at
> android.app.Activity.performCreate(Activity.java:4465)
> E/AndroidRuntime( 2446): at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
> E/AndroidRuntime( 2446): at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
> E/AndroidRuntime( 2446): at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
> E/AndroidRuntime( 2446): at
> android.app.ActivityThread.access$600(ActivityThread.java:123)
> E/AndroidRuntime( 2446): at
> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
> E/AndroidRuntime( 2446): at
> android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(
> 2446): at android.os.Looper.loop(Looper.java:137)
> E/AndroidRuntime( 2446): at
> android.app.ActivityThread.main(ActivityThread.java:4424)
> E/AndroidRuntime( 2446): at
> java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(
> 2446): at java.lang.reflect.Method.invoke(Method.java:511)
> E/AndroidRuntime( 2446): at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
> E/AndroidRuntime( 2446): at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
> E/AndroidRuntime( 2446): at
> dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 2446):
> Caused by: java.lang.UnsatisfiedLinkError: Couldn't load
> jni_factory_test: findLibrary returned null E/AndroidRuntime( 2446):
> at java.lang.Runtime.loadLibrary(Runtime.java:365) E/AndroidRuntime(
> 2446): at java.lang.System.loadLibrary(System.java:535)
My env is:
export LD_LIBRARY_PATH /vendor/lib:/system/lib
What should I do?
Try with system.load call with path to vendor lib