No cached version of com.android.tools.build:aapt2:3.5.1-5435860 available for offline mode. Disable

Error message

Insert image description here

Execution failed for task ':app:mergeDebugResources'.
> Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
   > Could not resolve com.android.tools.build:aapt2:3.5.1-5435860.
     Required by:
         project :app
      > No cached version of com.android.tools.build:aapt2:3.5.1-5435860 available for offline mode.
      > No cached version of com.android.tools.build:aapt2:3.5.1-5435860 available for offline mode.

Possible solution:
 - Disable offline mode and rerun the build
No cached version of com.android.tools.build:aapt2:3.5.1-5435860 available for offline mode.
Disable Gradle 'offline mode' and sync project

The error message shows that the appropriate tools cache cannot be found in offline mode. Please disable the offline mode of gradle and then synchronize the project.

Solution

Open Gradle in the sidebar and click offline mode. If there is a background selected, it is turned on. Otherwise, it is turned off. We need to ensure that it is turned off.
Insert image description here

Sync again and then run, the problem is successfully solved.
Insert image description here

Life needs a grateful heart to create, and a grateful heart needs life to nourish.

Guess you like

Origin blog.csdn.net/qq_42257666/article/details/131110204