achorein / expo-share-intent-demo

React Native Expo Share Intent Demonstration
90 stars 9 forks source link

Android building error android/gradlew exited with non-zero code: 1 #31

Closed petkobonev closed 8 months ago

petkobonev commented 9 months ago

Hey, great work on this guide. Really appreciate you putting it together.

Here's the error I'm seeing after expo run:android:

✖ Error: /Users/pbonev/react/thisisdope-app/android/gradlew exited with non-zero code: 1 Error: /Users/pbonev/react/thisisdope-app/android/gradlew exited with non-zero code: 1 at ChildProcess.completionListener (/Users/pbonev/react/thisisdope-app/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23) at Object.onceWrapper (node:events:628:26) at ChildProcess.emit (node:events:513:28) at maybeClose (node:internal/child_process:1098:16) at ChildProcess._handle.onexit (node:internal/child_process:304:5) ... at Object.spawnAsync [as default] (/Users/pbonev/react/thisisdope-app/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21) at spawnGradleAsync (/Users/pbonev/react/thisisdope-app/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:72:46) at Object.assembleAsync (/Users/pbonev/react/thisisdope-app/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:52:18) at runAndroidAsync (/Users/pbonev/react/thisisdope-app/node_modules/@expo/cli/build/src/run/android/runAndroidAsync.js:36:24) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.Some info that may or may not be relevant:

Expo 49 I'm in a yarn v1 workspace with my Expo app located at /packages/app, and package.json files at /package.json and /packages/app/package.json. plugins and patches dirs copied to /plugins and /patches, not to /packages/app/* /packages/app/package.json postinstall: expo-yarn-workspaces postinstall && patch-package postinstall-postinstall package not installed app.config.js plugins section:

achorein commented 9 months ago

can you give the output of the following command npx react-native info ? do you have any issue with the demo, it sounds like an integration on your own project problem.

petkobonev commented 9 months ago

Yeah, i have the integration issue, here is the output:

`System: OS: macOS 13.4 CPU: (8) arm64 Apple M2 Memory: 76.80 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 19.9.0 path: ~/.nvm/versions/node/v19.9.0/bin/node Yarn: version: 1.22.21 path: ~/react/thisisdope-app/node_modules/.bin/yarn npm: version: 9.6.3 path: ~/.nvm/versions/node/v19.9.0/bin/npm Watchman: Not Found Managers: CocoaPods: Not Found SDKs: iOS SDK: Platforms:

achorein commented 9 months ago

postinstall-postinstall package not installed did you forget to install this dep ? yarn add postinstall-postinstall

petkobonev commented 9 months ago

It's installed, nothing has changed.

achorein commented 9 months ago

after yarn install you should have this output : image

and this after prebuild: image

you error log message is incomplete and don't give the main error, I need the initial error before exited with non-zero code: 1 in order to help you.

petkobonev commented 9 months ago

Yes i have this outputs, but when try prebuild it gives me this -> `yarn run v1.22.19 $ /Users/pbonev/react/thisisdope-app/node_modules/.bin/expo prebuild ✔ Created native projects | /android, /ios already created | gitignore skipped › Using current versions instead of recommended react-native@0.72.6. ✔ Updated package.json and added index.js entry point for iOS and Android › Installing using yarn

yarn install ⠙ Config syncing**** scheme thisisdope ✖ Config sync failed TypeError: [ios.xcodeproj]: withIosXcodeprojBaseMod: Cannot read properties of null (reading 'path') TypeError: [ios.xcodeproj]: withIosXcodeprojBaseMod: Cannot read properties of null (reading 'path') at correctForPath (/Users/pbonev/react/thisisdope-app/node_modules/xcode/lib/pbxProject.js:1682:38) at correctForResourcesPath (/Users/pbonev/react/thisisdope-app/node_modules/xcode/lib/pbxProject.js:1672:12) at pbxProject.addResourceFile (/Users/pbonev/react/thisisdope-app/node_modules/xcode/lib/pbxProject.js:258:9) at /Users/pbonev/react/thisisdope-app/node_modules/expo-config-plugin-ios-share-extension/build/withShareExtensionXcodeTarget.js:37:20 at async action (/Users/pbonev/react/thisisdope-app/node_modules/@expo/config-plugins/build/plugins/withMod.js:201:23) at async interceptingMod (/Users/pbonev/react/thisisdope-app/node_modules/@expo/config-plugins/build/plugins/withMod.js:105:21) at async interceptingMod (/Users/pbonev/react/thisisdope-app/node_modules/@expo/config-plugins/build/plugins/withMod.js:105:21) at async interceptingMod (/Users/pbonev/react/thisisdope-app/node_modules/@expo/config-plugins/build/plugins/withMod.js:105:21) at async interceptingMod (/Users/pbonev/react/thisisdope-app/node_modules/@expo/config-plugins/build/plugins/withMod.js:105:21) at async interceptingMod (/Users/pbonev/react/thisisdope-app/node_modules/@expo/config-plugins/build/plugins/withMod.js:105:21) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

I saw a similar issue opened about but nothing helped there.

achorein commented 9 months ago

it seems that your xcode+3.0.1.patch has not been applied (like #22). you can verify in this file : node_modules/xcode/lib/pbxProject.js, you should have if (project.pbxGroupByName(group)&&project.pbxGroupByName(group).path) on line 1681

achorein commented 9 months ago

Duplicate of #22

achorein commented 9 months ago

yarn patch-package will apply all patches

that's why we got the postinstall in the package.json

  "scripts": {
    ...
    "postinstall": "patch-package"
  }
petkobonev commented 9 months ago

Yep, it worked, image After applying the patch and prebuild execution, ive got again the same error image

achorein commented 9 months ago

after the patch you need to clean up expo prebuild with : expo prebuild --no-install --clean

petkobonev commented 9 months ago

Yep i did it, still the same -> image

achorein commented 9 months ago

can you check your android/gradle.properties, should have this at the end of the file :

android.kotlinVersion=1.6.10

if it's already the case, you can try to change the version like this in the app.json (clean prebuild)

  "plugins": [
      [
        "./plugins/withAndroidShareExtension/index",
        {
          ...
          "androidExtraBuildProperties": { 
             "kotlinVersion": "1.8.10"
          },
        }
      ],
  ],
petkobonev commented 9 months ago

Yes the kotlin version is same as you described|

android.kotlinVersion=1.6.10

I applied the

  [
        "./plugins/withAndroidShareExtension/index",
        {
          "androidIntentFilters": ["text/*", "image/*"],
          "androidExtraBuildProperties": {
            "kotlinVersion": "1.8.10"
          }
        }
      ],

And still got the same issue.

achorein commented 9 months ago

:/ seems related to your java version, you are using java 20. Retry with java 18 (here for more information : https://stackoverflow.com/questions/67240279/could-not-open-settings-generic-class-cache-for-settings-file)

achorein commented 8 months ago

feel free to reopen if the problem persist

joshmohrer commented 8 months ago

Try adding this to your package.json

"overrides": { "@expo/config-plugins": "~7.8.4" },

wodin commented 8 months ago

Adding resolutions/overrides for @expo/config-plugins is usually a bad idea. The expo package should pull in the correct version. If there's something else trying to pull in some other version, then that should be fixed.

achorein commented 8 months ago

i'm working on new npm package which use a native module for android. Still in beta but you can give it a try with expo 50 https://www.npmjs.com/package/expo-share-intent