Rendering Problems Exception raised during rendering in API Level 24 - android

I have recently updated my API Level now its 24 and I noticed my layout previews weren't working, if I change API level 24 to 23 it works but on 24 its not working. anyone please help me.
Error:
Rendering Problems Exception raised during rendering: com/android/util/PropertiesMap**

I believe you've changed the API lvl this way.
This only changes the API lvl that Android Studio uses to render a preview, not the actual API lvl used in building your project. That means what you did here won't affect the actual build. So, don't worry about it, and there is nothing you can really do about it.
To actually change the API lvl, change the build.gradle file.

Related

How to set the compatible library in Android Studio

I know this has been asked before, but can not seem to find the answer in previous questions, so here goes.
I have created a project in Unity and exported it to Android Studio. I have set min API Level to 4.4 KitKat (API Level 19).
I have added: in the main manifest file. When building I get this error:
Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [:UniWebView:] /Users/myname/.gradle/caches/transforms-2/files-2.1/97563e885486a53e4f6658e98b58f094/jetified-UniWebView/AndroidManifest.xml as the library might be using APIs not available in 19
Suggestion: use a compatible library with a minSdk of at most 19,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="com.onevcat.uniwebview" to force usage (may lead to runtime failures)
How do i set the compatible library to minSdk 19? It needs to be 19 and not 21 due to the fact that if I release the update with 21 almost 20% of my users will be unable to play the game :-/
Units not compatible with API level 21+ = 2054 (19%)
Actually... A side question... Should I be afraid of upgrading API in term of loosing users? I have a version using API level 21 which is ready to be released.
If I should be carefull with this, how do I solve initial issue?
hoping for help and thanks in advance :-)
You basically have 4 options:
Increase you project's minSdk to 21 and lose users
Add tools:overrideLibrary="com.onevcat.uniwebview" to your manifests's application tag, which will probably lead to runtime crashes for your API 19 users (please test the whole thing heavily if you choose this option!!!)
Throw away the library and find another one. Or write your own solution
Fork the library (in case it's open sourced) and try to decrease its minSdk to 19
If I were you, I'd go with option 3

How to get a compile time error instead of NoSuchMethodError run-time error for android API level inconsistencies?

I have an Android Xamarin appliation with android:minSdkVersion="15" and android:targetSdkVersion="21". Turned out that IDE (xamarin studio, visual studio) and compilation process just ignore if I'm using something above API 15 which is not expected behavior here.
For example there is a method Path.addArc(float,float,float,float,float,float) from API 21 and I was able to use it with the manifest settings above which gave me a run-time error NoSuchMethodError.
There is an easy fix to use an overload Path.addArc(RectF,float,float) from API 1 but my question is more about how to get a compile time error instead or a run-time.
[UPDATE]
Basically I want to maintain the backward compatibility for API 15 (minimum android version) while having API 21 as a target android version. And I want to get an IDE support when I'm trying to use any method above API 15. That means I need a warning saying that I'm using a method which doesn't exist in the minimum android version defined so please do a run-time version check.
Is it possible?
To get compile time warnings you need to set your Target Framework to the min SDK you want to support. This will give you errors when you try to use higher level apis. Open Project Options dialog. In this dialog, click Build > General
You can read about api levels here https://developer.xamarin.com/guides/android/application_fundamentals/understanding_android_api_levels/#Target_Framework
If you just want to get an error while keeping the target framework the same you can modify your IDE preferences to throw a compile time error vs a warning.

import project for low api, stylev21 not found

I research material design project for 4.x API, It seem too many problems in style values, always style.... (in v-21) not found. I think v-21 is only build with api 21. But I want to build for 4.x API, do anyone know problem?
Here is some project in Github i found:
https://github.com/wasabeef/awesome-android-ui
https://github.com/rey5137/material
I use eclipse too. Change ANdroid API 21,22,23 but it still not work
The Log say : no resource found that matches the given name "TextAppearance.Appcompat.Body1"
Here is my picture:
OTHER QUESTION:
The Author say this material project can run on API 2.x -> 4.x , but why it need to build with API 21 -> 23? So can lower device can run it?
Set compileSdkVersion 23 or 21 or above in your build.gradle file.
The Log say : no resource found that matches the given name
"TextAppearance.Appcompat.Body1"
This is because you might not have imported AppCompat Library to your Eclipse Project.
The Author say this material project can run on API 2.x -> 4.x , but
why it need to build with API 21 -> 23? So can lower device can run
it?
Yes, Its always a good practice to build your App with the latest API version as this will include all the updated resources which might be not available in previous versions of Android. However, this will not affect your APK size in anyways.

Context.getExternalFilesDirs(null) is not defined

I am trying context.getExternalFilesDirs(null) to get paths for mounted storages. I intend to use this method keeping in view the new restrictions imposed by android in Kitkat. When I write statement to make a call to the method it gets underlined in RED with message as shown in image below:
I have checked all installations required to support API level 19 and everything seems fine.
My application is targeted for API 19 with minimum sdk version set to 16.
I have checked it a lot and looks like no one has faced this issue. I don't know what can possibly go wrong here but if you have any idea that where I am doing wrong please identify. Thank you
This is how I resolved the above issue.Right side click on Project -> Properties -> Android -> set Project Build Target to > Android 4.4.2 -> Apply
Check the documentation ,
getExternalFilesDirs()
has been added with API 19, and your min SDK is 16, you have to check that when you run on devices less than API 19 and there by organize your functionalities.You can Use TargetAPI annotation and then red underline will be removed.

Suppress AndroidManifest.xml minSdkVersion related warning

As recomended here http://developer.android.com/guide/practices/screens_support.html for compatibility reasons my AndroidManifest.xml contains this:
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4"/>
This generates warning in eclipse:
Attribute minSdkVersion (3) is lower
than the project target API level (4)
Are there any means to suppress this warning or get rid of it any other way? It is really annoying.
In short, there is no built-in way to do this that I know of.
Here's a discussion from last August.
And here is a Xavier Durochet's response.
It looks like you can manually remove it according to Mark Murphy's response in the first thread:
Or, you can modify SetupTask.java, eliminate this test (lines 297-308 in
the code indexed by Google Code Search), and build it into a custom
version of the Android Ant extension
There is a feature request that may deal with this, but who knows when it will be implemented.
The answer from 2011 is no longer accurate. It was fixed in ADT 17 according to this bug.
This warning is an usual one. I am using minSdkVersion to support Android 1.5 and I am building for Android 1.6 to support small screens. You can build your application with the latest Android 2.3 library, but still support a lower version.

Categories

Resources