Your SDK location contains non-ASCII characters - no Android in Tools Menu
As a matter of fact at the moment there is no other way than to re-install Android Studio to some other directory with no non-ASCII characters and blank spaces, like С:\Android\SDK
Fix AAPT2 ERROR in Android Studio with non-ASCII characters in Windows user name
The problem in this case was that I have non-ASCII characters in my Windows user name and thus in my user folder and gradle was set to use a folder under this user folder. You can change your visible user name in Windows, but you can not change your user name from your user folder without reinstalling.
Luckily you can change the folder gradle is using from Android Studio settings.
First make a .gradle
folder somewhere in your file system where you don't have those non-ASCII characters. (I chose to use C:\android-sdk\.gradle
)
Open File -> Settings -> Gradle
and there you can choose the "Service directory path" that Gradle is using. Change this to the folder you created and this problem should be solved.
NOTE!
I've faced this same problem when building react-native android apps too, so if you came here, because you got this same AAPT2 error with RN as well, try to change the gradle folder from you RN project's gradle files. At the moment I don't know how to do that and that's another question and topic too.
How to fix? Android Studio file path Error
You need to change the path of your SDK, it cannot be inside your Users/kullan... folder because of the non-ASCII characters in your User's name.
Here's a table of all the accepted ASCII characters
How to filter a Java Collection (based on predicate)?
Java 8 (2014) solves this problem using streams and lambdas in one line of code:
List<Person> beerDrinkers = persons.stream()
.filter(p -> p.getAge() > 16).collect(Collectors.toList());
Here's a tutorial.
Use Collection#removeIf
to modify the collection in place. (Notice: In this case, the predicate will remove objects who satisfy the predicate):
persons.removeIf(p -> p.getAge() <= 16);
lambdaj allows filtering collections without writing loops or inner classes:
List<Person> beerDrinkers = select(persons, having(on(Person.class).getAge(),
greaterThan(16)));
Can you imagine something more readable?
Disclaimer: I am a contributor on lambdaj
Related Topics
Detecting The Scrolling Direction in The Adapter (Up/Down)
Use 32-Bit Jni Libraries on 64-Bit Android
Combining Two Bitmap Image (Side by Side)
Successful Share Intent for Android
How to Add Cardview in Layout Xml in Androidx
Android Studio 3.1 Edittext Stackoverflowerror
No Resource Found That Matches The Given Name '@Style/ Theme.Holo.Light.Darkactionbar'
Multiple Notifications to The Same Activity
Findbugs Idea - Classnotfoundexception Com.Google.Wireless.Android.Sdk.Stats.Intellijindexingstats
How to Look-Up a Contact's Name from Their Phone Number on Android
How to Hide The Soft-Key Bar on Android Phone
How to Enable Cookies in Android Webview
How to Find The Amount of Free Storage (Disk Space) Left on Android
Linearlayout Height in Oncreate Is 0
Fragment in Viewpager Not Restored After Popbackstack
Loop Through All Subviews of an Android View