Android Studio 3.1 Gradle Plugin 4.4 KotlinNullPointerException - android

Surprisingly, my project is completely written and developed in Java only, it's also not containing any dependencies declared for Kotlin. Yet I'm receiving this weird error:
A problem occurred configuring project ':app'.
Configuration:
When I use the below configuration, it works perfectly fine, builds the project and the app gets installed on my device/emulator:
Android Studio Version: 3.1 Stable release
Gradle Plugin Version: 3.0.1
Gradle Distribution URL:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
BUT When I use the latest configuration declared below, the error occurs while running the app as shown in the images:
Android Studio Version: 3.1 Stable release
Gradle Plugin Version: 3.1.0
Gradle Distribution URL:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Steps I've followed/things I've tried:
Clean Project
Rebuild Project
Sync Project
Deleting build folder from project tree
Checked that project doesn't contain any names, references or declarations missing
Invalidate Caches/Restart
Check the whole dependency tree to make sure any Kotlin dependency is not imported or used as my project doesn't make use of Kotlin language
None of the above have worked!

I think instant run might be creating issue .
Do one thing disable instant run in android studio and try again .I think it might will resolve issue .

Try to update Android Studio. Turn off Instant Run from Settings ā†’ Build, Execution, Deployment ā†’ Instant Run and uncheck Enable Instant Run.

Related

com.android.tools.idea.run.ApkProvisionException: Couldn't get post build model

After downgrading from Gradle 6.1.1 to 7.2 and Android Gradle Build tools 7.1.0 to 4.0.1 (by switching branches in Git) I got the following exception in the Run console (tool window) of Android Studio Bumblebee 2021.1.1 (when trying to run the app on a device):
Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: Couldn't get post build model. Module: My_App.app Variant: debug
The Grade build runs successfully but the app won't be installed in the device.
In Android Studio run File > Invalidate Caches ... and restart (you don't need to select the optional "Clear file system cache and Local History"). Just to be sure, also run Build > Clean Project.
I have faced this issue when i upgrade to android studio Dolphin. So for me this workaround was to delete the existing app configuration from Run/Debug Configurations.
After that add new configuration by clicking the left top + icon and then add Android App.

How to fix gradle build problems on Android Studio 4 while importing projects?

I am a newbie in Android Studio. Currently, I am using Android Studio 4. While importing a project built on an older version (Github Link of the project), the gradle sync fails. The following error shows up:
Gradle sync failed: Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.10-all.zip'.
Consult IDE log for more details (Help | Show Log) (13 s 167 ms)
I have tried many ways to fix the issue but was unsuccessful.
You need to update gradle version.
Open https://github.com/udacity/ud839_Miwok/blob/lesson-one/gradle/wrapper/gradle-wrapper.properties and change version from 2.10 to 6.7.
Open https://github.com/udacity/ud839_Miwok/blob/lesson-one/build.gradle#L8 and change plugin version from 2.1.0 to 4.1.0.
Make sure you use Android studio 4.1.0+.
The first approach is to update your gradle from File->project structure->project to the latest version, before resync remember to clean project and sync again if problem still exist look for your classpath in gradle project level and make sure it is equal to the project classpath.

Unable to resolve Gradle sync failure (gradle-4.4) in Android studio 3.1.3

Being new to android studio, I have downloaded android studio version 3.1.3 with gradle build 4.4. Everytime I open android studio, gradle sync starts but never succeeds. This time it throws the following error:
A problem occurred configuring project ':app'.
I have tried disabling instant run, but unfortunately in my system there is no way of checking it out.
Rebuild and clear project did not make any changes.
How to sort out this problem as I have a project to be done with android studio?
gradle-wrapper.properties:
,
build.gradle:
I hope this will work for you.
Change class path 3.1.3 to 3.1.2
classpath 'com.android.tools.build:gradle:3.1.2'
and sync project. as per documentation for gradle version 4.4+ requires plugin version higher than 3.1.0+ and make sure requires internet connection.
Change the gradle version to 3.0.0 and then sync and re build the project. It might help

Android studio : when re-import the project it show's error and given a strange floders

while re-importing my project android studio show's plenty of errors
after cleaning and re-importing my project i have got an red circle with ā€œJā€ on my java files and i'am enable to run my project
Make sure that your gradle version is defined properly.
It seems that this project was on another PC and you imported it on your computer. I think that probably a gradle version conflict occurred and you have two options:
one is to let android studio download gradle version specified in TlaProject (gradle 2.4)
another solution is to edit app level 'build.gradle' file and change its version to a version which is available on your machine (to see which version is available on your system, please check 'gradle' folder inside installation folder of android studio)
My problem was solved by updating the version of android studio .

Android Studio: How to Migrate IntelliJ Project to Gradle?

I have a project that was originally from IntelliJ.
I followed the instructions below.
http://tools.android.com/tech-docs/new-build-system/migrating-from-intellij-projects
I'm not sure what to do next. When I load my project in Android Studio it still asks if I want to migrate to gradle. What did I miss?
I am able to use Gradle in the command prompt to build my project, so I assume I just need to tell Android Studio to use Gradle instead of Ant.
I next imported my existing project and it recognized it as a gradle project. I also had to change the gradle version in the gradle.build file to work with the newer version of Android Studio.

Categories

Resources