I have a project that uses the GoogleMaps API, and the support library for Fragments. I have a working map in one activity already, so I know that the API and library are all set up right. I am trying to add a map in a fragment as part of a new activity.
The activity extends an android.support.v4.app.FragmentActivity, and the xml file contains:
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="250dp"
android:name="com.google.android.gms.maps.SupportMapFragment" />
But when I run I get the error:
01-20 11:58:31.535: ERROR/AndroidRuntime(5389): FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
at android.app.Activity.setContentView(Activity.java:1835)
at com.yedidyak.gpsalarm.AddAlarm.onCreate(AddAlarm.java:19)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
All the information I can find about this error is about not having the google-play-lib properly installed both as a jar and an imported module, but I have that done - and a working map in another activity.
Any ideas?
You have to reference google play services library instead of adding jar and map_attrs.xml (and other files, like strings.xml) to your project.
If you do, you also might have deleted res/values/map_attrs.xml by accident.
Related
I recently moved to MoPub and it all appears to be working well except for I have started getting this exception saying that com.millennialmedia.android.VideoPlayer can not be found. I looked and it isn't on the Millennial jar (I just got the latest from their site). Also my AndroidManifest mentions that class and Android Studio also says it can't be found.
This is what I have there:
<activity android:name="com.millennialmedia.android.MMActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboardHidden|orientation|keyboard" />
<activity android:name="com.millennialmedia.android.VideoPlayer" android:configChanges="keyboardHidden|orientation|keyboard" />
On Android Studio the VideoPlayer part is red.
This is the exception I got:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{mypackage/com.millennialmedia.android.VideoPlayer}: java.lang.ClassNotFoundException: Didn't find class "com.millennialmedia.android.VideoPlayer" on path: /data/app/mypackage-1.apk
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.millennialmedia.android.VideoPlayer" on path: /data/app/mypackage-1.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(NativeStart.java)
Looking at the latest Millennial Media documentation, it looks like
com.millennialmedia.android.VideoPlayer
isn't included. This may be an update that needs to be made.
Alice
I was initially using the calendar view and that was fine.
i wanted to display my events in the calendar view so i tried extended calendar view library.
When i imported the library project and integrated the code i am getting the following error.
FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #7: Error inflating class provider
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at com.ithoughtz.sns.MainActivity$PlaceholderFragment.onCreateView(MainActivity.java:171)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:454)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: android.view.provider
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.view.LayoutInflater.createView(LayoutInflater.java:552)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:643)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
... 19 more
Kindly let me know if i need to post code.
XML for calendar view as follows
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical" >
<provider
android:name="com.tyczj.extendedcalendarview.CalendarProvider"
android:authorities="com.tyczj.extendedcalendarview.calendarprovider" />
<com.tyczj.extendedcalendarview.ExtendedCalendarView
android:id="#+id/calendar"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
provider is a tag that has to be declared in the AndroidManifast.xml file of your project for declaring ContentProviders and not in the layout file.
provider is not an xml tag that is why your exception stack states the cause to be provider class not found.
right click on project->Build path->configer Build path-> order and export-> checked all option->press OK...
Now try to run your project
My application normally working fine without any crashes. In some case(Don't know the scenario) my application crash. The logcat shows the error Resources$NotFoundException . This resource is the:
setContentView(R.layout.practise_menu);
Have any idea about this scenario? When it is possible to crash like this?
My Logcat error is
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.x.y/com.x.y}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030032
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4895)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030032
at android.content.res.Resources.getValue(Resources.java:1026)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2131)
at android.content.res.Resources.getLayout(Resources.java:865)
at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:306)
at android.app.Activity.setContentView(Activity.java:1912)
at com.x.y.onCreate(Practitioner_menu.java:749)
at android.app.Activity.performCreate(Activity.java:5163)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4895)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
at dalvik.system.NativeStart.main(NativeStart.java)
I got this error report from crashlytics. Please help me to find out.
there is issue of the layout resolution,i have faced these kind of issue many times, better create folder structure as given bellow
layout-large
layout-small
layout-medium
I found the issue:
I just created different folders for landscape and portrait
e.g ->
layout-land
layout-port
But in Androidmanifest file i set the orientation as landscape.
Once i call intent for this activity and press power button and rotate the screen app crash and got this exception.
I don't know what is happening but i guess when the screen rotating it searches the xml file in layout-land and layout-port.
I'm using the Android V2 Google Maps Library (Google Play Services) in my published app. I've been seeing sporadic exceptions show up in Google Play that seem to suggest the support map fragment occasionally tries to check the network state. However, the library documentation does not mention that this permission is required. I don't check the network state directly in my application, so I did not declare this permission. As a result a SecurityException is sometimes thrown when inflating the support map fragment:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.foo/com.foo.ui.TransactionDetailActivity}: android.view.InflateException: Binary XML file line #327: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #327: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.inflate(LayoutInflater.java:459)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
at com.actionbarsherlock.internal.ActionBarSherlockNative.setContentView(SourceFile:119)
at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SourceFile:262)
at com.foo.ui.TransactionDetailActivity.onCreate(SourceFile:129)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
... 11 more
Caused by: java.lang.SecurityException: ConnectivityService: Neither user 10106 nor current process has android.permission.ACCESS_NETWORK_STATE.
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.net.IConnectivityManager$Stub$Proxy.getActiveNetworkInfo(IConnectivityManager.java:623)
at android.net.ConnectivityManager.getActiveNetworkInfo(ConnectivityManager.java:425)
at maps.bm.e.e(Unknown Source)
at maps.bm.e.a(Unknown Source)
at maps.z.ag.a(Unknown Source)
at maps.z.ag.a(Unknown Source)
at maps.z.ag.a(Unknown Source)
at maps.z.bw.a(Unknown Source)
at maps.z.r.onCreateView(Unknown Source)
at com.google.android.gms.maps.internal.IMapFragmentDelegate$Stub.onTransact(IMapFragmentDelegate.java:107)
at android.os.Binder.transact(Binder.java:310)
at com.google.android.gms.maps.a.l.a(Unknown Source)
at com.google.android.gms.maps.m.a(Unknown Source)
at com.google.android.gms.internal.ap.a(Unknown Source)
at com.google.android.gms.internal.al.a(Unknown Source)
at com.google.android.gms.internal.al.a(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
at android.support.v4.app.FragmentManagerImpl.moveToState(SourceFile:846)
at android.support.v4.app.FragmentManagerImpl.moveToState(SourceFile:1061)
at android.support.v4.app.FragmentManagerImpl.addFragment(SourceFile:1160)
at android.support.v4.app.FragmentActivity.onCreateView(SourceFile:272)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
... 28 more
I have declared the relevant permission in my manifest and will see if that fixes the problem. However, it's concerning that this would only happen on some devices and not others. For example, this has worked fine on our internal test devices and many others. Does anyone have any insight into this mysterious issue? Could it be caused by a proguard error?
Edit 1: This error occurred while using version 2.0.10 (541717-10) of the Google Play Services library.
With the latest release of the Google Play Services library the documentation has been updated to indicate this permission is required.
The release notes indicate why this permission is required:
Improved recovery from gaining network connectivity. This fix requires the ACCESS_NETWORK_STATE permission.
Yes. Any use of the getActiveNetworkInfo() method will require the network state access permission.
The following line in your Manifest should do the trick:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Currently for my 2.x preference screens, in every PreferenceActivity I add the line setContentView(R.layout.activity_preferences); to have a custom layout in my activities.
The activity_preferences.xml layout file looks like this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout style="#style/TitleBar">
<ImageButton style="#style/TitleBarAction"
android:src="#drawable/ic_title_home"
android:onClick="onHomeClick" />
<ImageView style="#style/TitleBarSeparator" />
<eu.vranckaert.worktime.utils.view.CustomTextView
style="#style/TitleBarText" android:text="#string/lbl_preferences_title"/>
</LinearLayout>
<ListView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#android:id/list"/>
</LinearLayout>
For my 3.x and up application I am building the preferences according to the example over here: http://developer.android.com/reference/android/preference/PreferenceActivity.html.
In order to apply the same layout to my 3.x app, I tried was to add the setContentView(..) in the 3.x PreferenceActivity.
Result on phone: this works fine on the first activity, then when loading a fragment (with the real preferences in them) my style is not applied
Result on tablet: crash:
ERROR/AndroidRuntime(2208): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{eu.vranckaert.worktime/eu.vranckaert.worktime.activities.preferences.PreferencesICSActivity}: java.lang.IllegalArgumentException: No view found for id 0x10202d4 for fragment TimeRegistrationsPreferencesFragment{4101ed38 #0 id=0x10202d4}
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: No view found for id 0x10202d4 for fragment TimeRegistrationsPreferencesFragment{4101ed38 #0 id=0x10202d4}
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:822)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1032)
at android.app.BackStackRecord.run(BackStackRecord.java:622)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1382)
at android.app.Activity.performStart(Activity.java:4474)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1929)
... 11 more
When I try to apply the layout file on my fragments using getActivity().setContentView(R.layout.activity_preferences); the result is:
for phone: the activity is still shown fine, when going into a category it crashes:
ERROR/AndroidRuntime(1320): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{eu.vranckaert.worktime/eu.vranckaert.worktime.activities.preferences.PreferencesICSActivity}: java.lang.IllegalArgumentException: No view found for id 0x10202d4 for fragment DateTimePreferencesFragment{412a0d78 #0 id=0x10202d4}
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: No view found for id 0x10202d4 for fragment TimeRegistrationsPreferencesFragment{412a0d78 #0 id=0x10202d4}
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:822)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1032)
at android.app.BackStackRecord.run(BackStackRecord.java:622)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1382)
at android.app.Activity.performStart(Activity.java:4474)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1929)
... 11 more
for tablet: same crash as before...
How should I apply this layout file to my fragment activity...? Or should I create a new layout file?