how to resolve gradle sync failed in android - android-studio

I have react native project when run android this error showed
Gradle sync failed: Could not find method compile() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Related

Getting gradle sync failed error when I try creating a module

I tried creating a module in Android Studio. The module appears in my project structure but not the sidebar. Its dependencies aren't showing up under gradle scripts and I'm getting an error message saying that gradle sync failed.
I tried creating a module named MeepMeepTesting in Android Studio using New --> Module --> Java or Kotlin Library. I gave the library and class the same name. The module shows up in my Project Structure, but not in the sidebar, and I also cannot find its build.gradle under Gradle Scripts. This is the error I get when I tried creating the module: Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly. In my build window, I'm getting the message "null"
I updated my gradle and made sure I'm not in offline mode.
I'm unsure why this is happening, as I have already completed this process twice successfully.

Get Gradle sync failed: java.lang.NullPointerException when import android project from git

I download new android studio 3.5.1.
When I create new project it is okay to work.
But, when I pulled a android project from git (it working ok before) and import it get this error "Gradle sync failed: java.lang.NullPointerException". And no more information.
How can I fix this error?
I had rebuild,Sync project with gradle file, invalidate cache/restart but it not work

Why are Jenkins and Android Studio having different results on building an android project with gradle?

I am working on a jenkins build server for an android project that uses gradle as build-tool.
The jenkins job checkouts the same git branch as my android studio project and tries to build but fails at one point whereas when I build the project with android studio, I do not get any errors. Where could be reason for this?
Task :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
C:\Windows\System32\config\systemprofile.gradle\caches\transforms-2\files-2.1\9fe834a1339d0af409079f662a365996\res\drawable\abc_btn_colored_material.xml: error: file not found.
There is no error when I build the project with android studio :(

Error:Cannot invoke method systemProperty() on null object // New setup of Android Studio

I have installed Android Studio and linked it to my Gradle Project.
This is the first time I have set this up and then once I have installed everything (plugins etc) i get the following error message in Message Gradle Sync:
Gradle 'my-project' project refresh failed
Error:Cannot invoke method systemProperty() on null object
The event log shows:
12:08 AM Gradle sync failed: Cannot invoke method systemProperty() on null object
Consult IDE log for more details (Help | Show Log)
Please can someone tell me where I am going wrong?
Project structure shows Gradle version 3.3
Android plugin version is blank (not sure if that is this is issue)
Could someone please tell me how I can resolve this?
Thanks

Android Studio Gradle Peer not authenticated

With Android Studio 1.2.2, I am unable to build with gradle with the following message:
Error:A problem occurred configuring root project 'android'.
A problem occurred configuring project ':CordovaLib'.
Could not resolve all dependencies for configuration ':CordovaLib:classpath'.
Could not resolve com.android.tools.build:gradle:1.0.0+.
Required by:
android:CordovaLib:unspecified
Could not resolve com.android.tools.build:gradle:1.0.0+.
Failed to list versions for com.android.tools.build:gradle.
Unable to load Maven meta-data from https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml.
Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml'.
peer not authenticated
I tried downloading gradle 2.4 and setting the gradle distribution locally, but still did not help.
Also, making the following change in the build file did not work.
jcenter {
url "http://jcenter.bintray.com/"
}
How can this be resolved?

Resources