I am trying to run very simple program which start with:
MainActivity extends UnityPlayerActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
But on the on create i get this error:
04-02 09:38:39.227: E/AndroidRuntime(32578): Device fingerprint: samsung/GT-I9100/GT-I9100:4.1.2/JZO54K/I9100XWLSW:user/release-keys
04-02 09:38:39.227: E/AndroidRuntime(32578): Caused by:java.lang.ExceptionInInitializerError
04-02 09:38:39.227: E/AndroidRuntime(32578): at com.unity3d.player.UnityPlayerActivity.onCreate(Unknown Source)
04-02 09:38:39.227: E/AndroidRuntime(32578): at com.example.t.MainActivity.onCreate(MainActivity.java:17)
04-02 09:38:39.227: E/AndroidRuntime(32578): at android.app.Activity.performCreate(Activity.java:5206)
04-02 09:38:39.227: E/AndroidRuntime(32578): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
04-02 09:38:39.227: E/AndroidRuntime(32578): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
04-02 09:38:39.227: E/AndroidRuntime(32578): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load main: findLibrary returned null
04-02 09:38:39.227: E/AndroidRuntime(32578): at java.lang.Runtime.loadLibrary(Runtime.java:365)
04-02 09:38:39.227: E/AndroidRuntime(32578): at java.lang.System.loadLibrary(System.java:535)
04-02 09:38:39.227: E/AndroidRuntime(32578): at com.unity3d.player.UnityPlayer.<clinit>(Unknown Source)
I use compiler 1.6 and took the jar - classes.jar from the unity folder
What can be wrong?
I think the problem is in the manifest.
Come here and follow the instructions!
Related
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" />
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'm trying to get the Blackjack Google TV sample working on a Vizio Co-Star (Google TV). I downloaded the sample code from https://code.google.com/p/googletv-android-samples/ but when I deploy it to the Vizio, I get an OutOfMemory error.
Has anyone gotten the Blackjack GTV sample working?
Full Stack Trace:
04-02 13:32:56.364: E/dalvikvm-heap(4027): Out of memory on a 78655376-byte allocation.
04-02 13:32:56.374: E/AndroidRuntime(4027): FATAL EXCEPTION: main
04-02 13:32:56.374: E/AndroidRuntime(4027): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.tv.blackjack/com.google.android.tv.blackjack.BlackJackTableActivity}: android.view.InflateException: Binary XML file line #17: Error inflating class
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1836)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1852)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.app.ActivityThread.access$500(ActivityThread.java:124)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.os.Looper.loop(Looper.java:132)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.app.ActivityThread.main(ActivityThread.java:4196)
04-02 13:32:56.374: E/AndroidRuntime(4027): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 13:32:56.374: E/AndroidRuntime(4027): at java.lang.reflect.Method.invoke(Method.java:491)
04-02 13:32:56.374: E/AndroidRuntime(4027): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
04-02 13:32:56.374: E/AndroidRuntime(4027): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
04-02 13:32:56.374: E/AndroidRuntime(4027): at dalvik.system.NativeStart.main(Native Method)
04-02 13:32:56.374: E/AndroidRuntime(4027): Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.view.LayoutInflater.createView(LayoutInflater.java:596)
04-02 13:32:56.374: E/AndroidRuntime(4027): at com.android.internal.policy.impl.tv.TvLayoutInflater.onCreateView(TvLayoutInflater.java:50)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:644)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.view.LayoutInflater.inflate(LayoutInflater.java:457)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.view.LayoutInflater.inflate(LayoutInflater.java:347)
04-02 13:32:56.374: E/AndroidRuntime(4027): at com.android.internal.policy.impl.tv.TvWindow.setContentView(TvWindow.java:248)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.app.Activity.setContentView(Activity.java:1809)
04-02 13:32:56.374: E/AndroidRuntime(4027): at com.google.android.tv.blackjack.BlackJackTableActivity.onCreate(BlackJackTableActivity.java:58)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.app.Activity.performCreate(Activity.java:4438)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1800)
04-02 13:32:56.374: E/AndroidRuntime(4027): ... 11 more
04-02 13:32:56.374: E/AndroidRuntime(4027): Caused by: java.lang.reflect.InvocationTargetException
04-02 13:32:56.374: E/AndroidRuntime(4027): at java.lang.reflect.Constructor.constructNative(Native Method)
04-02 13:32:56.374: E/AndroidRuntime(4027): at java.lang.reflect.Constructor.newInstance(Constructor.java:416)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.view.LayoutInflater.createView(LayoutInflater.java:576)
04-02 13:32:56.374: E/AndroidRuntime(4027): ... 23 more
04-02 13:32:56.374: E/AndroidRuntime(4027): Caused by: java.lang.OutOfMemoryError
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.graphics.Bitmap.nativeCreate(Native Method)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.graphics.Bitmap.createBitmap(Bitmap.java:604)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:524)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:499)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:351)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:738)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.content.res.Resources.loadDrawable(Resources.java:1918)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.view.View.(View.java:2477)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.view.ViewGroup.(ViewGroup.java:379)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.widget.FrameLayout.(FrameLayout.java:94)
04-02 13:32:56.374: E/AndroidRuntime(4027): at android.widget.FrameLayout.(FrameLayout.java:90)
04-02 13:32:56.374: E/AndroidRuntime(4027): ... 26 more
If you open the layout file and remove the android:background="#drawable/green_background" from the source then it will work for you. There was a memory partition change recently and the sample has not been updated to reduce its memory footprint (eg. Big Bitmap image)
If I am using the Vibrator.vibrate(long) on an LG-E370 this is causing frequent application restarts. The vibrator permission has been added to the manifest and the vibrator vibrates up to 5 times before the app is restarting.
How can I vibrate reliably?
I added the output of a stacktrace to my onPause() and this is what I get:
04-02 14:39:36.384: dalvik.system.VMStack.getThreadStackTrace(Native Method)
04-02 14:39:36.384: java.lang.Thread.getStackTrace(Thread.java:737)
04-02 14:39:36.384: com.evotegra.aCoDriver.ACoDriverActivity.onPause(ACoDriverActivity.java:94)
04-02 14:39:36.384: android.app.Activity.performPause(Activity.java:3851)
04-02 14:39:36.384: android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1191)
04-02 14:39:36.424: android.app.ActivityThread.performNewIntents(ActivityThread.java:1747)
04-02 14:39:36.424: android.app.ActivityThread.handleNewIntent(ActivityThread.java:1757)
04-02 14:39:36.424: android.app.ActivityThread.access$2300(ActivityThread.java:117)
04-02 14:39:36.424: android.app.ActivityThread$H.handleMessage(ActivityThread.java:989)
04-02 14:39:36.424: android.os.Handler.dispatchMessage(Handler.java:99)
04-02 14:39:36.434: android.os.Looper.loop(Looper.java:130)
04-02 14:39:36.434: android.app.ActivityThread.main(ActivityThread.java:3740)
04-02 14:39:36.434: java.lang.reflect.Method.invokeNative(Native Method)
04-02 14:39:36.434: java.lang.reflect.Method.invoke(Method.java:507)
04-02 14:39:36.444: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
04-02 14:39:36.444: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:638)
04-02 14:39:36.444: dalvik.system.NativeStart.main(Native Method)
04-02 14:39:44.351: dalvik.system.VMStack.getThreadStackTrace(Native Method)
04-02 14:39:44.371: java.lang.Thread.getStackTrace(Thread.java:737)
04-02 14:39:44.371: com.evotegra.aCoDriver.ACoDriverActivity.onPause(ACoDriverActivity.java:94)
04-02 14:39:44.371: android.app.Activity.performPause(Activity.java:3851)
04-02 14:39:44.381: android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1191)
04-02 14:39:44.381: android.app.ActivityThread.performPauseActivity(ActivityThread.java:2356)
04-02 14:39:44.381: android.app.ActivityThread.performPauseActivity(ActivityThread.java:2326)
04-02 14:39:44.381: android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2818)
04-02 14:39:44.401: android.app.ActivityThread.access$1600(ActivityThread.java:117)
04-02 14:39:44.401: android.app.ActivityThread$H.handleMessage(ActivityThread.java:946)
04-02 14:39:44.411: android.os.Handler.dispatchMessage(Handler.java:99)
04-02 14:39:44.411: android.os.Looper.loop(Looper.java:130)
04-02 14:39:44.411: android.app.ActivityThread.main(ActivityThread.java:3740)
04-02 14:39:44.462: java.lang.reflect.Method.invokeNative(Native Method)
04-02 14:39:44.462: java.lang.reflect.Method.invoke(Method.java:507)
04-02 14:39:44.462: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
04-02 14:39:44.482: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:638)
04-02 14:39:44.492: dalvik.system.NativeStart.main(Native Method)
04-02 14:39:44.772: W/ServerManager(8731): <!>com.evotegra.aCoDriver.data.ServerManager$ConnectionManager 559<!> Connection thread was interrupted. Message: null
04-02 14:39:44.862: dalvik.system.VMStack.getThreadStackTrace(Native Method)
04-02 14:39:44.862: java.lang.Thread.getStackTrace(Thread.java:737)
04-02 14:39:44.862: com.evotegra.aCoDriver.ACoDriverActivity.onPause(ACoDriverActivity.java:94)
04-02 14:39:44.862: android.app.Activity.performPause(Activity.java:3851)
04-02 14:39:44.862: android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1191)
04-02 14:39:44.862: android.app.ActivityThread.performPauseActivity(ActivityThread.java:2356)
04-02 14:39:44.862: android.app.ActivityThread.performPauseActivity(ActivityThread.java:2326)
04-02 14:39:44.862: android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2818)
04-02 14:39:44.872: android.app.ActivityThread.access$1600(ActivityThread.java:117)
04-02 14:39:44.872: android.app.ActivityThread$H.handleMessage(ActivityThread.java:946)
04-02 14:39:44.872: android.os.Handler.dispatchMessage(Handler.java:99)
04-02 14:39:44.872: android.os.Looper.loop(Looper.java:130)
04-02 14:39:44.872: android.app.ActivityThread.main(ActivityThread.java:3740)
04-02 14:39:44.872: java.lang.reflect.Method.invokeNative(Native Method)
04-02 14:39:44.872: java.lang.reflect.Method.invoke(Method.java:507)
04-02 14:39:44.872: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
04-02 14:39:44.872: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:638)
04-02 14:39:44.872: dalvik.system.NativeStart.main(Native Method)
04-02 14:39:48.315: dalvik.system.VMStack.getThreadStackTrace(Native Method)
04-02 14:39:48.315: java.lang.Thread.getStackTrace(Thread.java:737)
04-02 14:39:48.315: com.evotegra.aCoDriver.ACoDriverActivity.onPause(ACoDriverActivity.java:94)
04-02 14:39:48.315: android.app.Activity.performPause(Activity.java:3851)
04-02 14:39:48.315: android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1191)
04-02 14:39:48.325: android.app.ActivityThread.performPauseActivity(ActivityThread.java:2356)
04-02 14:39:48.335: android.app.ActivityThread.performPauseActivity(ActivityThread.java:2326)
04-02 14:39:48.345: android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2306)
04-02 14:39:48.345: android.app.ActivityThread.access$1700(ActivityThread.java:117)
04-02 14:39:48.345: android.app.ActivityThread$H.handleMessage(ActivityThread.java:953)
04-02 14:39:48.355: android.os.Handler.dispatchMessage(Handler.java:99)
04-02 14:39:48.355: android.os.Looper.loop(Looper.java:130)
04-02 14:39:48.355: android.app.ActivityThread.main(ActivityThread.java:3740)
04-02 14:39:48.355: java.lang.reflect.Method.invokeNative(Native Method)
04-02 14:39:48.375: java.lang.reflect.Method.invoke(Method.java:507)
04-02 14:39:48.375: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
04-02 14:39:48.375: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:638)
04-02 14:39:48.385: dalvik.system.NativeStart.main(Native Method)
I am trying to integrate Twitter in my Application. I want a pop-up to be shown in which the user can enter his tweet.
Now when the user is already logged in, the application is working fine, but if the user needs to log-in first then the applications opens the twitter web-interface of login. From there, I am not able to come back to my application and show the 'enter-tweet' popup.
Please help.
Exception:
04-02 00:16:53.511: ERROR/AndroidRuntime(5992): java.lang.RuntimeException: Unable to resume activity {mad.android.MyTwitterApp/mad.android.MyTwitterApp.AndroidTwitterSample}: java.lang.NullPointerException
04-02 00:16:53.511: ERROR/AndroidRuntime(5992): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3128)
04-02 00:16:53.511: ERROR/AndroidRuntime(5992): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3143)
04-02 00:16:53.511: ERROR/AndroidRuntime(5992): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2059)
04-02 00:16:53.511: ERROR/AndroidRuntime(5992): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 00:16:53.511: ERROR/AndroidRuntime(5992): at android.os.Looper.loop(Looper.java:123)
04-02 00:16:53.511: ERROR/AndroidRuntime(5992): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-02 00:16:53.511: ERROR/AndroidRuntime(5992): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 00:16:53.511: ERROR/AndroidRuntime(5992): at java.lang.reflect.Method.invoke(Method.java:521)
04-02 00:16:53.511: ERROR/AndroidRuntime(5992): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
04-02 00:16:53.511: ERROR/AndroidRuntime(5992): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
04-02 00:16:53.511: ERROR/AndroidRuntime(5992): at dalvik.system.NativeStart.main(Native Method)