android icon indicating copy to clipboard operation
android copied to clipboard

Get gradle error every time after npm clean

Open arpitjivanitecan opened this issue 2 years ago • 3 comments

Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI:
  • nativescript version 8.5.3
  • Cross-platform modules:
  • Android Runtime:
  • iOS Runtime (if applicable):
  • Plugin(s):
{
  "name": "testapp",
  "main": "src/main.ts",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@angular/animations": "~15.2.0",
    "@angular/common": "~15.2.0",
    "@angular/compiler": "~15.2.0",
    "@angular/core": "~15.2.0",
    "@angular/forms": "~15.2.0",
    "@angular/platform-browser": "~15.2.0",
    "@angular/platform-browser-dynamic": "~15.2.0",
    "@angular/router": "~15.2.0",
    "@nativescript/angular": "^15.2.0",
    "@nativescript/core": "~8.5.0",
    "@nativescript/theme": "~3.0.2",
    "nativescript-auth0": "^4.1.0",
    "nativescript-ui-sidedrawer": "~15.2.0",
    "rxjs": "~7.6.0",
    "zone.js": "~0.13.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~15.2.0",
    "@angular/compiler-cli": "~15.2.0",
    "@nativescript/android": "8.5.0",
    "@nativescript/types": "~8.5.0",
    "@nativescript/webpack": "~5.0.14",
    "@ngtools/webpack": "~15.2.0",
    "typescript": "~4.8.4"
  }
}

Get this error with gradle version 7.5 and it takes this version automatically

Searching for devices...
Preparing project...
webpack is watching the files...
assets by path *.js 17.2 MiB
  asset vendor.js 16.6 MiB [compared for emit] (name: vendor) (id hint: defaultVendor)
  asset bundle.js 360 KiB [compared for emit] (name: bundle)
  asset runtime.js 88.5 KiB [compared for emit] (name: runtime)
  asset src_app_home_home_module_ts.js 25.6 KiB [compared for emit]
  asset src_app_user_user_module_ts.js 18.2 KiB [compared for emit]
  asset src_app_featured_featured_module_ts.js 11.4 KiB [compared for emit]
  + 3 assets
assets by path fonts/*.ttf 374 KiB
  asset fonts/fa-solid-900.ttf 204 KiB [compared for emit] [from: src/fonts/fa-solid-900.ttf] [copied]
  asset fonts/fa-brands-400.ttf 131 KiB [compared for emit] [from: src/fonts/fa-brands-400.ttf] [copied]
  asset fonts/fa-regular-400.ttf 39.1 KiB [compared for emit] [from: src/fonts/fa-regular-400.ttf] [copied]
assets by path assets/*.png 14.5 KiB
  asset assets/nativescript-angular-logo.png 10.8 KiB [compared for emit] [from: src/assets/nativescript-angular-logo.png] [copied]
  asset assets/auth0-logo.png 3.73 KiB [compared for emit] [from: src/assets/auth0-logo.png] [copied]
Entrypoint bundle 17.1 MiB = runtime.js 88.5 KiB vendor.js 16.6 MiB bundle.js 360 KiB
runtime modules 25.4 KiB 13 modules
orphan modules 6.96 KiB [orphan] 7 modules
modules by path ./node_modules/ 5.59 MiB
  javascript modules 5.33 MiB 609 modules
  json modules 273 KiB
    modules by path ./node_modules/mdn-data/css/*.json 242 KiB 3 modules
    modules by path ./node_modules/css-tree/ 30.7 KiB 2 modules
modules by path ./src/ 152 KiB
  modules by path ./src/app/ 26.5 KiB 22 modules
  modules by path ./src/*.ts 4.75 KiB 2 modules
  ./src/app.android.scss 120 KiB [built] [code generated]
  ./src/common/config.ts 565 bytes [built] [code generated]
external "~/package.json" 42 bytes [optional] [built] [code generated]
webpack 5.76.1 compiled successfully in 14536 ms
Webpack compilation complete. Watching for file changes.
         ~ applying user-defined configuration from C:\Users\AR022301\NativeScriptExamples\testapp\App_Resources\Android\before-plugins.gradle
Built aar for @nativescript/core
Updating runtime package.json with configuration values...
Project successfully prepared (android)
Building project...
Gradle build...
         + applying user-defined configuration from C:\Users\AR022301\NativeScriptExamples\testapp\App_Resources\Android\before-plugins.gradle
         + applying user-defined configuration from C:\Users\AR022301\NativeScriptExamples\testapp\App_Resources\Android\before-plugins.gradle
         + applying user-defined configuration from C:\Users\AR022301\NativeScriptExamples\testapp\App_Resources\Android\app.gradle
         + using android X library androidx.multidex:multidex:2.0.1
         + adding nativescript runtime package dependency: nativescript-optimized-with-inspector
         + adding aar plugin dependency: C:\Users\AR022301\NativeScriptExamples\testapp\node_modules\@nativescript\core\platforms\android\core.aar
         + adding aar plugin dependency: C:\Users\AR022301\NativeScriptExamples\testapp\node_modules\@nativescript\core\platforms\android\widgets-release.aar    
         + adding aar plugin dependency: C:\Users\AR022301\NativeScriptExamples\testapp\node_modules\nativescript-auth0\platforms\android\nativescript_auth0.aar 
         + adding aar plugin dependency: C:\Users\AR022301\NativeScriptExamples\testapp\node_modules\nativescript-ui-core\platforms\android\TNSCore-release.aar  
         + adding aar plugin dependency: C:\Users\AR022301\NativeScriptExamples\testapp\node_modules\nativescript-ui-sidedrawer\platforms\android\TNSSideDrawer-release.aar

Build file 'C:\Users\AR022301\NativeScriptExamples\testapp\platforms\android\app\build.gradle' line: 586
A problem occurred configuring project ':app'.
C:\Users\AR022301\NativeScriptExamples\testapp\platforms\android\.gradle\7.5\fileHashes\fileHashes.bin (The system cannot find the file specified)

Unable to apply changes on device: emulator-5554. Error is: Command gradlew.bat failed with exit code 1.

arpitjivanitecan avatar Jun 28 '23 10:06 arpitjivanitecan

Sounds like a possibly a corrupted gradle cache on your system, I would try renaming

C:\Users\%USERNAME%\.gradle

to .gradle-bkp (just in case that doesn't help, you can restore it) and trying again.

rigor789 avatar Jun 28 '23 13:06 rigor789

Unzipping C:\Users\AR022301.gradle\wrapper\dists\gradle-7.5-bin\f1w0cc9nuo0eivz97x2xlu9sv\gradle-7.5-bin.zip to C:\Users\AR022301.gradle\wrapper\dists\gradle-7.5-bin\f1w0cc9nuo0eivz97x2xlu9sv

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring root project 'core'.

java.util.concurrent.ExecutionException: java.lang.RuntimeException: Failed to release lock on instrumented jar cache

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 48s Failed to build plugin @nativescript/core :
Error: Command gradlew.bat failed with exit code 1

after renaming that it shows this error do you have any idea about that?

arpitjivanitecan avatar Jun 28 '23 13:06 arpitjivanitecan

Reboot the system? Sounds like something is keeping some files open in the background and preventing gradle from using them.

rigor789 avatar Jun 28 '23 13:06 rigor789