In my Android Studio java app - error upon running the app:
"C:\Program Files\Android\Android Studio\jbr\bin\java.exe" -Dfile.encoding=windows-1252 -jar "D:\work\Android Studio\SongTracker\app\build\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug\R.jar"
Error: Invalid or corrupt jarfile D:\work\Android Studio\SongTracker\app\build\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug\R.jar
Process finished with exit code 1
The problem started after adjusting xml code - working with a RecyclerView
inside a NestedScrollView
- originally ran into error about not being able to find a @mipmap/ic_launcher
file, then morphed into something like this:
Unable to delete directory 'D:\work\Android Studio\SongTracker\app\build'
Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
In doing research found one 'fix' to edit the R.jar
file by running in the terminal
window:
unzip R.jar
and jar -xf R.jar
which might have escalated the problem. It seemed to do nothing however the problem continues to escallate into something I cannot solve all related to my R.jar
file.
Here are some of the attempts to rectify the situation - NONE of these made any difference:
taskkill /im java.exe /f
Clean Project
then Rebuild Project
- both processes completed without any errorsapp/build
directory, then Cleaned
and Rebuilt
projectadb.exe
(which shows as adb (32bit) in task manager) from task manager - thanks @General Tony for the suggestion!Here is the Application
portion of my AndroidManifest.xml
:
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.SongTracker"
tools:targetApi="31">
I notice a R.jar
dropdown menu at the top of my AS desktop - not sure if this was always there and I never noticed or if this is a prompt for further action, here is what I am seeing:
Thank you in advance for any feedback or insight that you can offer.
best
Still not exactly sure how I got into this but getting out turned out, at least in my case to be very simple.
In the R.jar
drop down menu I selected the Run Configurations
option for the app:
This was the solution, again for me, after running the configurations the R.jar
drop down was replaced by the app
drop down. I am now able to run the app without problem.