I'm using Robotium to automate my app testing. My app has 1 activity (ActionBarActivity) and 2 fragments (using support.v4.app.Fragment). The app works fine but when I attempt to run a Robotium test, I get an error when attempting to create a new Solo instance.
solo = new Solo(getInstrumentation(), getActivity());
Logcat output:
java.lang.NoSuchMethodError: No static method setOnApplyWindowInsetsListener(Landroid/view/View;Landroid/support/v4/view/OnApplyWindowInsetsListener;)V in class Landroid/support/v4/view/ViewCompat; or its super classes (declaration of 'android.support.v4.view.ViewCompat' appears in /data/app/com.mycompany.mytrip.test-1/base.apk)
E/AndroidRuntime( 5220): at android.support.v7.app.ActionBarActivityDelegateBase.ensureSubDecor(ActionBarActivityDelegateBase.java:304)
E/AndroidRuntime( 5220): at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:225)
E/AndroidRuntime( 5220): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
E/AndroidRuntime( 5220): at com.mycompany.mytrip.activities.MainActivity.onCreate(MainActivity.java:38)
E/AndroidRuntime( 5220): at android.app.Activity.performCreate(Activity.java:5933)
E/AndroidRuntime( 5220): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
E/AndroidRuntime( 5220): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
E/AndroidRuntime( 5220): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
E/AndroidRuntime( 5220): at android.app.ActivityThread.access$800(ActivityThread.java:144)
E/AndroidRuntime( 5220): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
E/AndroidRuntime( 5220): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 5220): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 5220): at android.app.ActivityThread.main(ActivityThread.java:5221)
E/AndroidRuntime( 5220): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 5220): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 5220): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/AndroidRuntime( 5220): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
W/ActivityManager( 1229): Error in app com.mycompany.mytrip running instrumentation ComponentInfo{com.mycompany.mytrip.test/android.test.InstrumentationTestRunner}:
W/ActivityManager( 1229): java.lang.NoSuchMethodError
W/ActivityManager( 1229): java.lang.NoSuchMethodError: No static method setOnApplyWindowInsetsListener(Landroid/view/View;Landroid/support/v4/view/OnApplyWindowInsetsListener;)V in class Landroid/support/v4/view/ViewCompat; or its super classes (declaration of 'android.support.v4.view.ViewCompat' appears in /data/app/com.mycompany.mytrip.test-1/base.apk)
D/AndroidRuntime( 5209): Shutting down VM
Any suggestion much appreciated!
Related
I have compiled an system from AOSP and fastboot it into Nexus 7. I am now trying to write a very simple app to test the location updates through Network provider.
I have a sim card installed and enabled all the settings but I always get the errors shown below. It seems like there is no network provider. But How can I enabled it?? I have been stuck in this for ages and have no clues.(GPS is working fine)
D/PbdTrial( 4527): Network provider NOT enabled
D/AndroidRuntime( 4527): Shutting down VM
E/AndroidRuntime( 4527): FATAL EXCEPTION: main
E/AndroidRuntime( 4527): Process: com.example.jack.pbdtrial, PID: 4527
E/AndroidRuntime( 4527): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.jack.pbdtrial/com.example.jack.pbdtrial.MainActivity}: java.lang.IllegalArgumentException: provider doesn't exist: network
E/AndroidRuntime( 4527): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
E/AndroidRuntime( 4527): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
E/AndroidRuntime( 4527): at android.app.ActivityThread.access$800(ActivityThread.java:144)
E/AndroidRuntime( 4527): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
E/AndroidRuntime( 4527): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 4527): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 4527): at android.app.ActivityThread.main(ActivityThread.java:5221)
E/AndroidRuntime( 4527): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 4527): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 4527): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/AndroidRuntime( 4527): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/AndroidRuntime( 4527): Caused by: java.lang.IllegalArgumentException: provider doesn't exist: network
E/AndroidRuntime( 4527): at android.os.Parcel.readException(Parcel.java:1544)
E/AndroidRuntime( 4527): at android.os.Parcel.readException(Parcel.java:1493)
E/AndroidRuntime( 4527): at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:584)
E/AndroidRuntime( 4527): at android.location.LocationManager.requestLocationUpdates(LocationManager.java:867)
E/AndroidRuntime( 4527): at android.location.LocationManager.requestLocationUpdates(LocationManager.java:459)
E/AndroidRuntime( 4527): at com.example.jack.pbdtrial.MainActivity.onCreate(MainActivity.java:73)
E/AndroidRuntime( 4527): at android.app.Activity.performCreate(Activity.java:5933)
E/AndroidRuntime( 4527): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
E/AndroidRuntime( 4527): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
Have you added this to your manifest?
<manifest ... >
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
...
</manifest>
Also, to be sure you have enable the location update in your phone setting, you can prompt the user to enable it using this method
I have an activity and it consists of two fragments. The app switches between one of these fragments very frequently. I am using code like this to switch between fragments,
fragmentTransaction
.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left)
.remove(fragment2)
.add(R.id.common_container, fragment1)
.commit();
The above code removes fragment2 and adds fragment1. The above code works fine but when I try to switch between fragments frequently an exception showing this trace is coming up,E/AndroidRuntime( 8809): java.lang.IllegalStateException: No activity
E/AndroidRuntime( 8809): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1054)
E/AndroidRuntime( 8809): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1049)
E/AndroidRuntime( 8809): at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1869)
E/AndroidRuntime( 8809): at android.app.Fragment.performActivityCreated(Fragment.java:2067)
E/AndroidRuntime( 8809): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:912)
E/AndroidRuntime( 8809): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
E/AndroidRuntime( 8809): at android.app.BackStackRecord.run(BackStackRecord.java:834)
E/AndroidRuntime( 8809): at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1452)
E/AndroidRuntime( 8809): at android.app.FragmentManagerImpl$1.run(FragmentManager.java:447)
E/AndroidRuntime( 8809): at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime( 8809): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 8809): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 8809): at android.app.ActivityThread.main(ActivityThread.java:5254)
E/AndroidRuntime( 8809): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 8809): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 8809): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
E/AndroidRuntime( 8809): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
I know that i can use replace instead of adding and removing, but there are other fragments where i cannot replace because the container is different.
Can anyone help me ?
Edit:
Even replacing fragment also causes this exception
I have layout
R.layout.alarm_clock_setting_view
And i want to Inject him into LayoutInflater.
Now i do next :
#InjectView(R.layout.alarm_clock_setting_view)
private RelativeLayout alarmClockSettingView;
...
//in OnCreate
mSettingAlarmClockView = alarmClockSettingView;
...
But that's not worked. What i need to do to inject layout into LayoutInflater?
Error :
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.samsung.clock/com.samsung.clock.views.ClockFragmentActivity}: java.lang.IllegalStateException: Unable to use annotation database(s)
E/AndroidRuntime( 3754): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2658)
E/AndroidRuntime( 3754): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2725)
E/AndroidRuntime( 3754): at android.app.ActivityThread.access$900(ActivityThread.java:172)
E/AndroidRuntime( 3754): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1422)
E/AndroidRuntime( 3754): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 3754): at android.os.Looper.loop(Looper.java:145)
E/AndroidRuntime( 3754): at android.app.ActivityThread.main(ActivityThread.java:5834)
E/AndroidRuntime( 3754): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 3754): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 3754): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
E/AndroidRuntime( 3754): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
E/AndroidRuntime( 3754): Caused by: java.lang.IllegalStateException: Unable to use annotation database(s)
E/AndroidRuntime( 3754): at roboguice.RoboGuice.initializeAnnotationDatabaseFinderAndHierarchyTraversalFilterFactory(RoboGuice.java:292)
E/AndroidRuntime( 3754): at roboguice.RoboGuice.getOrCreateBaseApplicationInjector(RoboGuice.java:149)
E/AndroidRuntime( 3754): at roboguice.RoboGuice.getOrCreateBaseApplicationInjector(RoboGuice.java:90)
E/AndroidRuntime( 3754): at roboguice.RoboGuice.getInjector(RoboGuice.java:197)
E/AndroidRuntime( 3754): at roboguice.activity.RoboFragmentActivity.onCreate(RoboFragmentActivity.java:60)
E/AndroidRuntime( 3754): at MainActivity.onCreate(MainActivity.java:95)
E/AndroidRuntime( 3754): at android.app.Activity.performCreate(Activity.java:6221)
E/AndroidRuntime( 3754): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
E/AndroidRuntime( 3754): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2611)
E/AndroidRuntime( 3754): ... 10 more
I have used 1920x1080 resolution image for all layout background.I got OutOfMemory Exception.Then I used different images for different resolutions in different folders,but still i am getting OutOfMemory Exception.Please can any one help me.Below is the my logcat.
E/AndroidRuntime( 3997): FATAL EXCEPTION: main
E/AndroidRuntime( 3997): Process: com.pm.a, PID: 3997
E/AndroidRuntime( 3997): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pm.a/com.activities.services.ConfirmDetails}: android.view.InflateException: Binary XML file line #48: Error inflating class <unknown>
E/AndroidRuntime( 3997): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
E/AndroidRuntime( 3997): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
E/AndroidRuntime( 3997): at android.app.ActivityThread.access$900(ActivityThread.java:161)
E/AndroidRuntime( 3997): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
E/AndroidRuntime( 3997): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 3997): at android.os.Looper.loop(Looper.java:157)
E/AndroidRuntime( 3997): at android.app.ActivityThread.main(ActivityThread.java:5356)
E/AndroidRuntime( 3997): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3997): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 3997): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
E/AndroidRuntime( 3997): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
E/AndroidRuntime( 3997): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 3997): Caused by: android.view.InflateException: Binary XML file line #48: Error inflating class <unknown>
E/AndroidRuntime( 3997): at android.view.LayoutInflater.createView(LayoutInflater.java:626)
E/AndroidRuntime( 3997): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
E/AndroidRuntime( 3997): at com.activities.services.ConfirmDetails.onCreate(ConfirmDetails.java:90)
E/AndroidRuntime( 3997): at android.app.Activity.performCreate(Activity.java:5426)
E/AndroidRuntime( 3997): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
E/AndroidRuntime( 3997): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
E/AndroidRuntime( 3997): ... 11 more
E/AndroidRuntime( 3997): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 3997): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 3997): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.createView(LayoutInflater.java:600)
E/AndroidRuntime( 3997): ... 26 more
E/AndroidRuntime( 3997): Caused by: java.lang.OutOfMemoryError
E/AndroidRuntime( 3997): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
E/AndroidRuntime( 3997): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:677)
E/AndroidRuntime( 3997): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:507)
E/AndroidRuntime( 3997): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:872)
E/AndroidRuntime( 3997): at android.content.res.Resources.loadDrawable(Resources.java:3056)
E/AndroidRuntime( 3997): at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
E/AndroidRuntime( 3997): at android.widget.ImageView.<init>(ImageView.java:133)
E/AndroidRuntime( 3997): at android.widget.ImageView.<init>(ImageView.java:123)
E/AndroidRuntime( 3997): ... 29 more
W/ActivityManager( 3050): Force finishing activity com.activities.services.ConfirmDetails
Thanking in Advance.
The OOM errors are a real pain in the a$$.
All you can do is resize your image to lower quality and/or enable largeHeap.
Have a look to this:
Bitmap recycle with largeHeap enabled
I'm trying to port the Contacts APK from the galaxy S5 to the Galaxy S4.
I got a FC when I tried to launch the application. I would like to get some help fixing this issue.
E/AndroidRuntime( 3085): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.contacts/com.android.contacts.activities.PeopleActivity}: android.view.InflateException: Binary XML file line #71: Error inflating class <unknown>
E/AndroidRuntime( 3085): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
E/AndroidRuntime( 3085): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
E/AndroidRuntime( 3085): at android.app.ActivityThread.access$900(ActivityThread.java:161)
E/AndroidRuntime( 3085): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
E/AndroidRuntime( 3085): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 3085): at android.os.Looper.loop(Looper.java:157)
E/AndroidRuntime( 3085): at android.app.ActivityThread.main(ActivityThread.java:5356)
E/AndroidRuntime( 3085): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3085): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 3085): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
E/AndroidRuntime( 3085): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
E/AndroidRuntime( 3085): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
E/AndroidRuntime( 3085): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 3085): Caused by: android.view.InflateException: Binary XML file line #71: Error inflating class <unknown>
E/AndroidRuntime( 3085): at android.view.LayoutInflater.createView(LayoutInflater.java:626)
E/AndroidRuntime( 3085): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
E/AndroidRuntime( 3085): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
E/AndroidRuntime( 3085): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
E/AndroidRuntime( 3085): at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
E/AndroidRuntime( 3085): at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
E/AndroidRuntime( 3085): at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
E/AndroidRuntime( 3085): at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:627)
E/AndroidRuntime( 3085): at android.view.LayoutInflater.inflate(Native Method)
E/AndroidRuntime( 3085): at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
E/AndroidRuntime( 3085): at com.android.dialer.dialpad.DialpadFragment.onCreateView(DialpadFragment.java:672)
E/AndroidRuntime( 3085): at android.app.Fragment.performCreateView(Fragment.java:1700)
E/AndroidRuntime( 3085): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:890)
E/AndroidRuntime( 3085): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
E/AndroidRuntime( 3085): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1044)
E/AndroidRuntime( 3085): at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1853)
E/AndroidRuntime( 3085): at android.app.Activity.performCreate(Activity.java:5429)
E/AndroidRuntime( 3085): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
E/AndroidRuntime( 3085): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
E/AndroidRuntime( 3085): ... 12 more
E/AndroidRuntime( 3085): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 3085): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 3085): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
E/AndroidRuntime( 3085): at android.view.LayoutInflater.createView(LayoutInflater.java:600)
E/AndroidRuntime( 3085): ... 30 more
E/AndroidRuntime( 3085): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/dialpad_background.xml from drawable resource ID #0x7f0200e2
E/AndroidRuntime( 3085): at android.content.res.Resources.loadDrawable(Resources.java:3010)
E/AndroidRuntime( 3085): at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
E/AndroidRuntime( 3085): at android.content.res.XResources$XTypedArray.getDrawable(XResources.java:797)
E/AndroidRuntime( 3085): at android.view.View.<init>(View.java:3694)
E/AndroidRuntime( 3085): at android.view.View.<init>(View.java:3624)
E/AndroidRuntime( 3085): ... 33 more
E/AndroidRuntime( 3085): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: <bitmap> requires a valid src attribute
E/AndroidRuntime( 3085): at android.graphics.drawable.BitmapDrawable.inflate(BitmapDrawable.java:577)
E/AndroidRuntime( 3085): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:973)
E/AndroidRuntime( 3085): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:913)
E/AndroidRuntime( 3085): at android.content.res.Resources.loadDrawable(Resources.java:3006)
E/AndroidRuntime( 3085): ... 37 more
W/ActivityManager( 1126): Force finishing activity com.android.contacts/.activities.PeopleActivity
Here is the zip containing the files from the app from apktool.
SecContacts