Unknown attribute warning in XML - android-studio

AndroidManifest and XML layouts are showing me the Unknown attribute android: warning even though the attributes exist and the app works on the device.
Example: Unknown attribute android:maxSdkVersion, android:clickable="true" etc.
I am aware of the other questions regarding this issue and tried everything I could find about this topic but nothing works for me.
I tried to:
Sync Project with Gradle Files
Delete the .idea and .gradle folders from the project location
Delete caches from c:\Users\<user>\.gradle\caches\
Invalidate caches and restart ...and many other things I couldn't remember right now.
The problem still persists on a newly installed OS (Windows 11) and obviously, newly installed Android Studio, and also the issue affects only old projects...
Also, my project is up to date with everything the Android Studio doesn't show me any warning to update a version of a dependency or so.
Gradle version 7.3.3
Android Gradle Plugin Version 7.2.1
Update:
The warning appears only with the SDK version 33 (compileSdkVersion 33), if I build with version 32, the warning disappears...
Update2:
New projects which use API level 33 still show the warning...
Maybe it's a bug in the SDK?

UPD 20.01.2023: You can update Android Studio to the latest version now (Android Studio Electric Eel | 2022.1.1) and this bug is fixed there. Worked for me.
OLD: Got same crap and a lot of other.
And yes, just downgraded buildToolsVersion to "32.1.0 rc1" and targetSdkVersion, compileSdkVersion to API 32 for as long as bug exists in API 33.

Same here, I use this temporary workaround until Android team fix this issue or better solution.
Move all require code for Android 13 into library module (in my case, all of them are moved into utility module) and keep it use compile SDK 33
Temporary changes compile SDK in other module to 32 for local development

It's not ideal, but switching to Dolphin RC1 resolves this. Given that it will (presumably) hit stable pretty soon, it may not get fixed in Chipmunk. You can download Dolphin from the Android Studio Preview page, just be aware that it is not available as an installer so you will need to manually update your installed version or use it alongside until it hits stable.

Perfect!!
set compileSdkVersion to 32
compileSdkVersion 32
set targetSdkVersion to 32
targetSdkVersion 32
downgrade androidx.core:core-ktx
implementation 'androidx.core:core-ktx:1.8.0'

This config works for me:
Android Studio Dolphin | 2021.3.1
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
compileSdk 33 (SDK 33 Rev. 2, Sources 33 Rev. 1)
buildToolsVersion "33.0.0"
targetSdkVersion 33
Gradle Plugin version 7.3.0.

Related

Android Studio 4.1 Canary 9 201.6466190-linux distribution corrupted?

At first I've tried to update Android Studio 4.1 Canary 8 to Canary 9 as usual through update dialog. At the first start Canary 9 have thrown error:
Missing essential plugin:
org.jetbrains.android
Please reinstall Android Studio from scratch.
So I downloaded Canary 9 distribution from official source (https://developer.android.com/studio/preview). Deleted Canary 8 catalog and extracted tar.gz with Canary 9. Then launched android-studio/bin/studio.sh with the same error.
I renamed ~/.AndroidStudioPreview4.1 catalog and started studio once more. Same error.
Now I rolled back to Canary 8 from my backup.
Any help how to move from Canary 8 to 9?
Basically this issue mentioned in release notes
In Android Studio 4.1 Canary 9, you may see the following error when
first launching Android Studio after upgrading:
missing essential plugin org.jetbrains.android
This can happen when you import your settings from a previous version
of Android Studio. Typically, this means you have a locally installed
Kotlin plugin that is not compatible with the new IDE.
To fix this issue, remove the Kotlin directory from the following
locations:
Linux: ~/.local/share/Google/AndroidStudioPreview4.1
Windows:
C:\Users\YourUserName\AppData\Roaming\Google\AndroidStudioPreview4.1
MacOS: ~/Library/Application Support/Google/AndroidStudioPreview4.1
Because there is no Kotlin plugin compatible with Canary 9 currently
available from JetBrains, we have bundled our own Kotlin plugin with
the Canary 9 update, so you don't need to manually install a Kotlin
plugin.
source
At the same time by path ~/.local/share/Google/AndroidStudioPreview4.1 no such file or directory. The only catalog named AndroidStudioPreview4.1 founded by ./.cache/Google/AndroidStudioPreview4.1. So I deleted it without any effect on subject issue.
Then I completely removed ~/.AndroidStudioPreview4.1 instead of renaming which I'd done before. And resolved the issue.
I believe Google bundle Kotlin plugin in a different way JetBrains do. So paths differ. Maybe path for Windows to. I believe paths should be corrected in release notes.
Solution:
rm -r ~/.AndroidStudioPreview4.1
Solved this problem by using terminal in Ubuntu 18.04.5 LTS
toumbou#toumbou-Aspire-V3-471:~$ cd ~/.AndroidStudio4.0/config
toumbou#toumbou-Aspire-V3-471:~/.AndroidStudio4.0/config$ ls
codestyles disabled_plugins.txt inspection plugins tasks user.token
colors disabled_update.txt options port.lock terminal workspace
toumbou#toumbou-Aspire-V3-471:~/.AndroidStudio4.0/config$
and open the file via nautilus
toumbou#toumbou-Aspire-V3-471:~/.AndroidStudio4.0$ nautilus config
Then move the config folder and remove also the kotlinRefractoring.xml and also I removed the caches of my previous project so now I got it running fine again with some tweaks all things ares fine.

How to create signed apk from 32 bit to 64 bit?

My project configuration
React-native version: 0.55.3
Android Gradle Version: 3.3
Android api level: 26
It will create 32 bit apk, now we need to create 64 bit apk file to upload on play store but in the studio, facing some issue like
Could not determine Java version "12.0.1"
so I've updated the Gradle file to 5.4.1, compileSdkVersion from 26 to 28 and all other react native library to latest updates But I got too many errors in the studio.
WARNING: The following project options are deprecated and have been
removed: android.useDeprecatedNdk NdkCompile is no longer supported
WARNING: Configuration 'provided' is obsolete and has been replaced
with 'compileOnly'. It will be removed at the end of 2018. For more
information see:
http://d.android.com/r/tools/update-dependency-configurations.html
after this error studio stuck and too many other libraries do not link with the android studio.
How to solve useDeprecatedNdk error and how to convert compileSdkVersion API level to 28 to run APK successfully.
Update gradle file:
App level build.gradlew
Root level build.gradle
gradle.properties
Old gradle version
App level build.gradle
root level build.gradle
graddle.wrapper.properties
react native package.json file
you can migrate your code with androidx and minimum apilevel 21
Google Play Changes in 2021:
All application that do not support a 64-bit version will not be available in the Google Play Market (including games written on the Unity engine)
read more
WHAT TO DO?
Thanks to ReactCommunity! As of March 12, 2019, ReactNative has a new version release 0.59.
Yes, they added hooks, but the important thing here is 64-bit support on Android.
So just upgrade your react native to the latest version and it will compile the App with 64 bit support!
How to Upgrade React Native??

How to solve the issue of mixing version of support libraries in Android Studio?

I received an update to android SDK. After the update, when I open a project, Android Studio recommends to update Android Gradle to v 2.3.0 and Gradle to v 3.3. I updated the project as recommended. After that I found an ugly red line under the appcompat-v7:25.2.0' (see pic).
The error, according to android studio, is that I am mixing versions of support libraries (v 25 and 24), but I didn’t find any support library of v24. I tried to build a signed apk, but app build failed (using V2 / full apk signature), so I searched the web and I found one solution to this problem by adding this line to the build.gradle: multiDexEnabled true. Adding that line fixed the problem of generating signed apk, although the red line of error was still there, it didn’t get rid of it.
Then I installed the signed apk on two phones, one running Android 6.0 and the other one is running Android 4.4.2. The app runs smoothly on Android 6.0 and crashes on start on Android 4.4.2 (I set minSdkVersion to 19).
My questions are: how can fix that error in the gradle permanently? Is adding the line “multiDexEnabled” to gradle really needed? How can I run my app on android 4.4.2 without crashing?
I'm had the same issue, just add these lines:
compile "com.android.support:animated-vector-drawable:${supportLibVersion}"
compile "com.android.support:mediarouter-v7:${supportLibVersion}"
In your case supportLibVersion is 25.2.0.

Android Studio can't open project

I've recently get update notification of android studio 2.3, after the update it's not opening any project and throwing error:
[plugin: com.darkklord.gradle.metric.core]
after downgrading and reinstalling i still have this issue, can anyone please help me on this topic ?
Download latest plugin from here: https://plugins.jetbrains.com/plugin/9197-android-gradle-metrics--checkstyle
Install Plugin manually from disk.
Restart Android Studio (The error will still occur)
Remove plugin in IDE.
Restart
You might also uninstall the refrenzed plugins Checkstyle and PMD
You need to change your dependency
classpath 'com.android.tools.build:gradle:3.1.0'
Sometimes you need to change name of project manually(look at AndroidStudioProjects folder) that you opened lastly.
After changing name, android studio will show all projects,
open one of them,
in file menu,
click open button,
then open your desire project (or change its name to its previous name)
change build:gradle plugin to:
classpath 'com.android.tools.build:gradle:3.3.2'
(in app gradle file)
I made sure that my Gradle version was compatible with my android gradle plug in. In my case I was using Gradle 6.0.1 and when I changed my android gradle plug in to version 3.5.3 the problem went away.
Project Structure----->> Project ------>> Android Gradle plug in version 3.5.3.
[https://docs.gradle.org/6.0.1/release-notes.html
[Java 14 and later versions are not yet supported.
Compatibility Notes
A Java version between 8 and 13 is required to execute Gradle.
Java 6 and 7 can still be used for compilation and forked test execution. Just like Gradle 5.x, any supported version of Java can be used for compile or test.
This version of Gradle is tested with
-------->>>>>>>>Android Gradle Plugin 3.4, 3.5 and 3.6
Kotlin 1.3.21 through 1.3.50
Other versions may or may not work.]]]]
I hope this helps

Android Studio: android-19 not found, but it's clearly installed

I've tried rebuilds, opening/closing android studio, switching to api level 18 and everything: I get this output:
Error:Module 'LabsCore': platform 'android-19' not found.
Error:Module 'facebook': platform 'android-19' not found.
In the sdk manager it is really all installed, I checked multiple times. Is this an issue with android studio/gradle plugin in the latest version?
I faced the same error after updrade to Android Studio 0.5.3/0.5.4. Take a look at this question. And the cholm's answer that was the solution for me.

Resources