After an update of Java
facing an issue of Process unexpectedly exit while creating the build for Android. I was using Android Studio 3.3
This error shows up because of latest version of AAPT library. Just add below code in your Project gradle file under allprojects section.
configurations.matching { it.name == '_internal_aapt2_binary' }.all { config ->
config.resolutionStrategy.eachDependency { details ->
details.useVersion("3.3.2-5309881")
}
}
As per your problem, just try to delete .iml
file of your existing project from the directory and then rebuild the project again. Hope it will work for you.
This problem of getting Process unexpectedly exit error usually occurs if you done a Android Studio upgrade or fresh install of android studio while without 'cleaning' traces of older versions of Android Studio. The reason could be that when you have multiple older versions of Android Studio residue files there is some conflict because of older version of .Android, .gradle, .cache and android sdk files/folders. I tried everything from clearing cashe, invalidating and restarting t downgrading gradle to different versions but nothing worked.
Next I decided to uninstall Android Studio 3.6.2 and do fresh install Android Studio 3.6.2 which is latest version as of 12th April 2020 () but that do did not remove the Process unexpectedly exit and even creating a new Hello World projectI would get the Process unexpectedly exit error .
in my 3rd try I again uninstalled Android Studio 3.6.2, then went to %userprofiles% and deleted the .Android, .gradle, .cache and delete android sdk folders. Reinstalled Android Studio 3.6.2 and the Process unexpectedly exit error was resolved. I have shared detailed steps so that you do not waste time in doing what I did for couple of days. Hope this is helpful.
Downgrade the version of gradle from
classpath 'com.android.tools.build:gradle:3.4.1'
to
classpath 'com.android.tools.build:gradle:3.1.4'
Your studio seems to be messed up so you should try resetting it by going to c/users/documents and delete these three folders .android,.androidstudio3.4,.gradle after deleting restart your studio and see if this fixes it