React Native Android No such property - logger for class DefaultProjectDescriptor - android-studio

I am developing my app using React Native and now when I open the android project in Android Studio, during gradle sync it is throwing this error:
A problem occurred evaluating settings 'MyApp'.
No such property: logger for class: org.gradle.initialization.DefaultProjectDescriptor
Caused by: groovy.lang.MissingPropertyException: No such property: logger for class: org.gradle.initialization.DefaultProjectDescriptor
I tried installing yarn add react-native-unimodules but this won't resolve.
I am using NVM to used node version 14.17.3
Android gradle plugin version: 4.1.0
Gradle version: 6.8
Please help me resolving this as I am stuck on this since 2 days now.

I had the same problem I tried different node versions with nvm and also downgrade android studio but none worked for me. also, I tried installing node via homebrew. What I did was to start android studio using
open -a /Applications/Android\ Studio.app
The problem was that android studio couldn't find node so in this case starting with the above command fixed the problem for me and I used nvm

I was able to resolve this issue by fully shutting down my MacBook Pro and starting it up again. Once started I loaded my project in Android Studio once again and let the gradle build finish.

Fixed this by downgrading Android studio to version 4.1.3.
Before that I installed Node through NVM but it didn`t help

I encountered this exact error on a new MacBook M1 where I formerly used Java 8 with Rosetta (from the migration). After installing Zulu Java 8/11 with ARM-64bit support, I could not build the React Native App anymore.
I simply deleted the .gradle folder (e.g. in ~/.gradle) and executed the build command again. It downloaded Gradle from scratch and the build worked.

The real fix is stackoverflow.com/a/70891538/9878385
Run chmod +x /Applications/Android\ Studio.app/Contents/bin/printenv and this actually fixes the problem, rather than just working around the problem.

Check Android Studio for available updates
Android Studio -> Check For Updates
I have updated Android Studio and Tools to the latest version and this solved the problem. Currently I have Android Studio Chipmunk | 2021.2.1 (Build on April 28, 2022)

I was facing the same issue. It could be some problem with permissions on Android Studio installation.
This might help you to open the project without this error, but it doesn't definitively solve the problem. (Ubuntu linux)
cd App_Name/android/
android-studio .

I had same error using ReactNative and NVM. Installing NodeJS through package manager solved the problem. I guess NVM environment wasn't loaded in Android Studio environment.

Related

Gradle daemon is going into infinity loop after upgrading android studio to 4.2.1

This is the image of gradle daemon
This is the version of the android studio
and I have tried to change heap size in the gradle properties but it is not working.
I am really stuck on this issue because any project is not building and even when I was trying to build new project it is also not working.
I update to 4.2.1 on my Mac today, when I open up a project it starts an infinity loop of android studio windows of that project, had to hard restart my Mac.
The only way I was able to fix it, was by going back to 4.1.3.
For solving this problem in windows run this command in cmd.
setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true
and this will work definetly.

Flutter compile error inside Android Studio

I had been developing a flutter mobile app for a couple of months and all was good. I just came back to the project and a few things (flutter, dart, android studio etc) upgraded. Now I can't compile my app. I created a new flutter app (the default example) and that won't compile either.
The error I'm getting is :
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings remapped class cache for bq3hllkgb26p0nrblf5gh8d37 (C:\Users\Paul\.gradle\caches\5.6.2\scripts-remapped\settings_cbd968glg60byp9f5t6vvdlee\bq3hllkgb26p0nrblf5gh8d37\settings8410a2d21ed2f87c8a0398566330ee52).
> Could not open settings generic class cache for settings file 'D:\Apps\Flutter\Examples\flutter_app\android\settings.gradle' (C:\Users\Paul\.gradle\caches\5.6.2\scripts\bq3hllkgb26p0nrblf5gh8d37\settings\settings8410a2d21ed2f87c8a0398566330ee52).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 57
I am running:
Flutter 1.20.2
Dart 2.9.1
Android Studio 4.1
Java 1.8.0_261
JVM 13.0.2
Gradle 6.7
Windows 10
Try running
flutter stable
flutter clean
flutter downgrade
cd <Your App Folder>
and then
flutter run
in command line
I ended up completely removing Flutter from my system and then re-installed it. This fixed everything.

Ionic Capacitor app give me lots of errors

I'm on Windows 10 and I've created a Ionic 5.0.7 app with Capacitor 2.0.0.
I use this command to build app:
ionic build
After, I use this command:
npx cap sync
And, to finish, I use this command to open Android Studio:
npx cap open android
The first problem come during building on Android Studio:
org.gradle.api.reflect.ObjectInstantiationException: Could not create
an instance of type
com.novoda.release.internal.compat.gradle5_3.AndroidSoftwareComponentCompat_Gradle_5_3.
Caused by: org.gradle.api.reflect.ObjectInstantiationException: Could not create
an instance of type
com.novoda.release.internal.compat.gradle5_3.AndroidSoftwareComponentCompat_Gradle_5_3.
And...
java.lang.NoClassDefFoundError:
org/gradle/api/internal/java/usagecontext/LazyConfigurationUsageContext
Caused by: java.lang.NoClassDefFoundError:
org/gradle/api/internal/java/usagecontext/LazyConfigurationUsageContext
I've other random errors... It's weird...
Update
Check #Carl Pool 's answer
They fixed it in the new capacitor Version, no need to downgrade anymore
Old Answer
To fix this downgrade Gradle and Gradle plugin in Android Studio.
File -> Project Structure -> Project
If you keep the plugin to 4.0.0 it will require a minimum Gradle version of 6 so put it back to a lower version like 3.6.3
Version 6 of Gradle does not support LazyConfigurationUsageContext as mentionened by #NishaBhat, so use 5.6.4 instead.
This issue currently has a ticket on Github:
https://github.com/ionic-team/capacitor/issues/3003
This issue has been resolved in Capacitor version 2.1.2.
https://github.com/ionic-team/capacitor/issues/3003
Please update the Capacitor dependencies in package.json to version 2.1.2 and then in Android Studio click the button to sync the project with Gradle.
"#capacitor/android": "^2.1.2",
"#capacitor/core": "2.1.2",
Switch to using gradle version 5.6.4. That did the trick for me. LazyConfigurationUsageContext doesn't have support in gradle versions 6.0+
I was getting an error
Cause: org/gradle/api/internal/java/usagecontext/LazyConfigurationUsageContext
I solved by downgraded distributionUrl(gradle/wrapper/gradle-wrapper.properties) to https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
it will give an error if above 6+
Same problem.. had many issues:
Errors and how I solved:
Error 1. Gradle sync failed: Server returned HTTP response code: 403 for URL: http://services.gradle.org/distributions/gradle-5.6.4-all.zip
Solution - Downloaded the zip file and stored in on my local in the \android\gradle\wrapper folder.
Updated the distribution URL to: distributionUrl=./gradle-5.6.4-all.zip
Error 2. java.lang.NoClassDefFoundError & java.lang.NoClassDefFoundError:
Solution - Downloaded Gradle version 5.6.4 and updated the environment variables.
Error 3. Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
Updated as per the image below
i have not downgraded the gradle version 6.1.1 But what i did is that:
I removed these lines from build.gradle file
apply plugin: 'com.novoda.bintray-release' &
classpath 'com.novoda:bintray-release:0.9.1'
The Issue just gone like Boom !!
I think this Bintray Dependencies just conflicting behind the scene.

Finish can only be called once : Android

Recently updated Build: 2.3.1, AI-162.3871768, 20170401,
AI-162.3871768, JRE 1.8.0_112-release-b06x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.11.6 unknown, screens 1440x900; Retina
Switching back to Android 2.2.2 did not help either. Successfully able to build from command Line though(MacOX Terminal)
Delete your $HOME/.gradle directory (or on Windows, %HOME%\.gradle folder). The next execution of gradle will rebuild this. (It will require some downloads, so make sure you have an internet connection).
You can try just deleting $HOME/.gradle/caches, but this will not solve the problem in all cases.
I have similar issue on 2.3.1
I tried using the Android 2.4 Preview 4 but that did not help. I am able to build from command line too.
Android-Studio-2.3.1-Gradle-Sync
It happens when Android Studio creates two instances of gradle. I tried clearing the gradle cache or even deleting the .gradle but did not help. All this problem started when I deleted my old project repo and re-pulled it and imported to my Android Studio.
Best is to delete all your gradle instance from your home directly before your re-import your project Android Studio.
Android Studio started behaving like this after I tried building with the command line(osx) using ./gradlew
What helps is running the studio with sudo:
sudo /Applications/Android\ Studio.app/Contents/MacOS/studio
I wonder if theres a fix to this problem that allows the studio to be started normally as well.

Android Studio - SequencePluginReload requires unknown plugin

In Android Studio 1.5.1, I'm trying to run the plugin SequencePluginReload 1.0.6. The installation works fine, but after restarting Android studio I get the following error message:
Problems found loading plugins: Plugin "SequencePluginReload" was not loaded: required plugin "com.intellij.diagram" not installed.
So I figured, I need to install the com.intellij.diagram plugin. However, I wasn't able to find it in the android studio repository or elsewhere. Any ideas where I could find it?
The issue appears to be resolved in the latest version.
For me, that is Android Studio 2.1.1 with SequenceDiagram 1.1. (They renamed the project)

Resources