Espresso testing on Android API 28 emulator click issue - android

This is only on Android devices with api level 28.
trying to match a text after clicking the spinner fails.
Two approaches, one looking for a window that is not the activity, the second is looking for popup menu:
...
// Look for text "Green" in the menu
onView(withId(getFieldId(COLOR_ID))).perform(click());
onView(withText("Green"))
.inRoot(withDecorView(not(is(rule.getActivity().getWindow().getDecorView())))) // Look for popup menu
.perform(click());
// Second spinner, Look for the text "Medium"
onView(withId(getFieldId(SIZE_ID))).perform(click());
onView(withText("Medium")).inRoot(RootMatchers.isPlatformPopup()).perform(click());
...
Both are working fine with devices API <=27
Any idea why this is not working on 28? Thank you.

Problem solved by updating build tools version to 28.0.2 (was 28.0.1) and replaced all android support libraries to use androidx

Related

Android Studio 2.1.2 Rendering problems. VectorDrawable_Delegate.nDraw

When attempting to view a preview of your app you may encounter the following...
Rendering Problems Exception
raised during rendering:
android.graphics.drawable.VectorDrawable_Delegate.nDraw(JJJLandroid/graphics/Rect;ZZ)I
Issue is resolved by de-selecting the API 23 preview as shown below, select the non Preview option.
I think I am a bit late to answer, but the solutions provided above did not work for me.
The rendering error sure does go away, but the rendering displayed finally after selecting API 23 is incomplete or wrong.
In my case, the action bar custom theme color and everything vanished.
So, for everyone out there who has a custom theme in their app, here's a solution -
Check if in the XML preview pane, the rendering theme is selected as the one which is associated with your app in the manifest file.
Select your custom theme in the preview pane, the error will be gone and you will also be able to preview with the latest API (API 24)

Android Studio 2.0 not showing menu icons in preview

I've done some searching but I couldn't find any concrete information about my issue. I have a standard Empty project in Android Studio to which I have added a logout icon in the Action bar. For some reason the icon is only visible when I run the project on a virtual device or on my phone but it's not visible inside the preview screen in Android Studios. Is it a known bug or am I just missing something?
In the design view of a XML File you should try to use a older Render version:
For me, the previewer shows the icon if I add android:showAsAction="ifRoom" within the item's declaration.

Same style on all API using AppCompat

I'm using com.android.support:appcompat-v7:22.2.0 to make Lolipop material design on pre-Lolipop devices. The problem is that widgets (example EditText) are displaying different views with different parameters on different API.
Question is how to make it all looks the same on all API 15 and above?
Example here (different bottom line, margin between text and line etc.):
I think that I found solution.
AppCompat generates proper look during inflating layout.
If API < 20 it generates look like newest API (ex. 22).
If API >= 21 it generates look depending on API.
Don't look at preview in XML (my image is from previews). Open emulator and check by yourself how it will looks on device.
Hope it helps someone in future.

XML is showing OLD API UI ANDroid

I am developing an app and using spinners(Using eclipse). I am using Fragments and also using support-v4 library. I have set MinSdkVersion to 8 for backword compativility.
The problem is, in XML, when I drag and drop spinners, it is showing me the old UI for spinner which was there in API 8 or 9 and designing UI is becoming almost impossible.
(However in my Phone, it is showing the latest UI for Spinner, but I can't design it well in XML - eclipse.)
Also attaching the URL of snapshot (as I don't have enough reputation to post and image) of the XML view within the eclipse.
Link to Image : http://tinyurl.com/ErrorInUI
I tried changing MinSdkVersion to 17. It didn't work.
In your XML Graphical editor, you can change the appearance by selecting the rendering style in the API Level dropdown (there's the current API Level number with an arrow, near the little green robot):

implement action bar on android API 7

I am working on Android 2.1 with API v7.
How can I implement the action bar in this old version API which can work like built-in ActionBar on devices supporting API 11 or greater? Is there any support package ?
(A good tutorial on how to implement action bar in old version API is appreciated)
Here is an examle of adding actionBar with slides menu to api>7:
https://github.com/BradleyRL/NavDrawerExampleAppCompat-v7
It's documented here for api>14 http://developer.android.com/training/implementing-navigation/nav-drawer.html. (first link - is upgraded method of second link to support previous versions).
Then, you could read documentation here: developer.android.com/guide/topics/ui/actionbar.html
To do this this way you must add project library to your project (and for exammple in 1t link too).
To do it: File>New>Other>Android Project From Existing Code>Browse (Select "YOUR_PATH_TO_ANDROID_SDK\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\extras\android\support\v7\appcompat"), check adding it to workspace>Finish.
Then go to properties of your(example in 1st link) project>android>add (choose this library)>OK.
And you must extend your main class from ActionBarActivity insted of Activity. I try this, and it work on 2.3.7 and on 4.1.1 versions)
Hope it helps)
P.S. Sorry for my bad english and hi from Russia)
You can/should use this ActionBar project.
It's very very simple to use and I am using it myself in one project.

Categories

Resources