PapillonApp / papillon-v6

Le client alternatif de vie scolaire ouvert à tous et porté par la communauté
https://getpapillon.xyz
GNU General Public License v3.0
132 stars 53 forks source link

[Bug]: BUILD FAILED (Code: 1) #280

Closed Slysoks closed 1 month ago

Slysoks commented 1 month ago

Description du bug

Quand je lance le script de dev sur android (npm run android), j'obtiens cette erreur que je n'arrive pas à résoudre. Pourriez-vous m'aider ?

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not find any matches for app.notifee:core:+ as no versions of app.notifee:core are available.
     Searched in the following locations:
       - file:/C:/Papillon/node_modules/react-native/android/app/notifee/core/maven-metadata.xml
       - file:/C:/Papillon/node_modules/jsc-android/dist/app/notifee/core/maven-metadata.xml
       - https://dl.google.com/dl/android/maven2/app/notifee/core/maven-metadata.xml
       - https://repo.maven.apache.org/maven2/app/notifee/core/maven-metadata.xml
       - https://www.jitpack.io/app/notifee/core/maven-metadata.xml
       - https://oss.sonatype.org/content/repositories/snapshots/app/notifee/core/maven-metadata.xml
     Required by:
         project :app > project :notifee_react-native

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2m 39s
10 actionable tasks: 10 up-to-date
Error: C:\Papillon\android\gradlew.bat exited with non-zero code: 1
Error: C:\Papillon\android\gradlew.bat exited with non-zero code: 1
    at ChildProcess.completionListener (C:\Papillon\node_modules\@expo\spawn-async\build\spawnAsync.js:52:23)
    at Object.onceWrapper (node:events:629:26)
    at ChildProcess.emit (node:events:514:28)
    at cp.emit (C:\Papillon\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5)
    ...
    at Object.spawnAsync [as default] (C:\Papillon\node_modules\@expo\spawn-async\build\spawnAsync.js:17:21)
    at spawnGradleAsync (C:\Papillon\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:72:46)
    at Object.assembleAsync (C:\Papillon\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:52:18)
    at runAndroidAsync (C:\Papillon\node_modules\@expo\cli\build\src\run\android\runAndroidAsync.js:36:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Étapes à reproduire

  1. Ouvrir le dossier racine dans un termial (Windows Powershell pour moi)
  2. Installer les dépendances NPM avec la commande npm install (=npm i)
  3. Connecter un appareil Android avec le mode USB Teethering (options de développeur)
  4. Lancer le projet avec la commande npm run android
  5. Attendre l'erreur (elle se situe à la fin du build, à 100%, plutôt déprimant)

Comportement attendu

BUILD COMPLETE

Appareil

Samsung A52 5G / ThinkPad P15s

Version du système d`exploitation

Android 14 / Windows 11 Pro (23H2)

Version

6.6.6

Environnement

Prébuild de développement (iOS/Android)

Service scolaire

🦋 Pronote

Captures d'écran / vidéo

No response

Contexte supplémentaire

No response

Gabriel29306 commented 1 month ago

Va dans ton dossier android du projet et exécutes ./gradlew clean. Si le problème persiste, supprimes le dossier node_modules puis npm install ou tu peux le faire manuellement : npm list puis trouves tous les problèmes UNMET DEPENDENCY.

Source: Could not determine the dependencies of task ':app:mergeDebugAssets'

Slysoks commented 1 month ago

❌ Build expo project:

PS C:\Papillon> npm run android

> papillonvex@6.6.6 android
> expo run:android

› Building app...
Configuration on demand is an incubating feature.

> Configure project :app
 ??  Applying gradle plugin 'expo-dev-launcher-gradle-plugin' (expo-dev-launcher@3.3.0)

> Configure project :notifee_react-native
:notifee_react-native @notifee/react-native found at C:\Papillon\node_modules\@notifee\react-native
:notifee_react-native package.json found at C:\Papillon\node_modules\@notifee\react-native\package.json
:notifee_react-native:version set from package.json: 7.8.2 (7,8,2 - 7008002)
:notifee_react-native:android.compileSdk using custom value: 33
:notifee_react-native:android.targetSdk using custom value: 33
:notifee_react-native:android.minSdk using custom value: 21
:notifee_react-native:reactNativeAndroidDir C:\Papillon\node_modules\react-native\android

> Configure project :expo

Using expo modules
  - legeek01-expo-in-app-purchases (1.0.0)
  - pchmn-expo-material3-theme (1.3.1)
  - expo-application (5.3.1)
  - expo-background-fetch (11.3.0)
  - expo-barcode-scanner (12.5.3)
  - expo-blur (12.4.1)
  - expo-calendar (11.3.2)
  - expo-clipboard (4.3.1)
  - expo-constants (14.4.2)
  - expo-crypto (12.4.1)
  - expo-dev-client (2.4.11)
  - expo-dev-launcher (3.3.0)
  - expo-dev-menu (3.2.1)
  - expo-device (5.4.0)
  - expo-document-picker (11.5.4)
  - expo-dynamic-app-icon (1.2.0)
  - expo-file-system (15.4.4)
  - expo-font (11.4.0)
  - expo-haptics (12.4.0)
  - expo-image-loader (4.3.0)
  - expo-image-picker (14.3.2)
  - expo-json-utils (0.7.1)
  - expo-keep-awake (12.3.0)
  - expo-linear-gradient (12.3.0)
  - expo-local-authentication (13.4.1)
  - expo-location (16.1.0)
  - expo-manifests (0.7.2)
  - expo-modules-core (1.5.11)
  - expo-modules-core$android-annotation (1.5.11)
  - expo-modules-core$android-annotation-processor (1.5.11)
  - expo-navigation-bar (2.3.0)
  - expo-notifications (0.20.1)
  - expo-sharing (11.5.0)
  - expo-splash-screen (0.20.5)
  - expo-store-review (6.4.0)
  - expo-system-ui (2.4.0)
  - expo-task-manager (11.3.0)
  - expo-web-browser (12.3.2)
  - unimodules-app-loader (4.2.0)

> Configure project :react-native-reanimated
No AAR for react-native-reanimated found. Attempting to build from source.
Android gradle plugin: 7.4.2
Gradle: 8.0.1
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not find any matches for app.notifee:core:+ as no versions of app.notifee:core are available.
     Searched in the following locations:
       - file:/C:/Papillon/node_modules/react-native/android/app/notifee/core/maven-metadata.xml
       - file:/C:/Papillon/node_modules/jsc-android/dist/app/notifee/core/maven-metadata.xml
       - https://dl.google.com/dl/android/maven2/app/notifee/core/maven-metadata.xml
       - https://repo.maven.apache.org/maven2/app/notifee/core/maven-metadata.xml
       - https://www.jitpack.io/app/notifee/core/maven-metadata.xml
       - https://oss.sonatype.org/content/repositories/snapshots/app/notifee/core/maven-metadata.xml
     Required by:
         project :app > project :notifee_react-native

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1m 1s
10 actionable tasks: 10 up-to-date
Error: C:\Papillon\android\gradlew.bat exited with non-zero code: 1
Error: C:\Papillon\android\gradlew.bat exited with non-zero code: 1
    at ChildProcess.completionListener (C:\Papillon\node_modules\@expo\spawn-async\build\spawnAsync.js:52:23)
    at Object.onceWrapper (node:events:629:26)
    at ChildProcess.emit (node:events:514:28)
    at cp.emit (C:\Papillon\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5)
    ...
    at Object.spawnAsync [as default] (C:\Papillon\node_modules\@expo\spawn-async\build\spawnAsync.js:17:21)
    at spawnGradleAsync (C:\Papillon\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:72:46)
    at Object.assembleAsync (C:\Papillon\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:52:18)
    at runAndroidAsync (C:\Papillon\node_modules\@expo\cli\build\src\run\android\runAndroidAsync.js:36:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

✅ Suppression du dossier ./node_modules/

PS C:\Papillon> rm .\node_modules\

Confirmer
L'élément situé à l'emplacement C:\Papillon\node_modules\ a des enfants et le paramètre Recurse n'a pas été spécifié. Si vous continuez, tous les enfants seront supprimés avec l'élément. Êtes-vous sûr de
vouloir continuer ?
[O] Oui  [T] Oui pour tout  [N] Non  [U] Non pour tout  [S] Suspendre  [?] Aide (la valeur par défaut est « O ») : t

⚠️ Installation des modules NPM

PS C:\Papillon> npm i
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @react-native-community/async-storage@1.12.1
npm WARN Found: react@18.2.0
npm WARN node_modules/react
npm WARN   react@"18.2.0" from the root project
npm WARN   49 more (@callstack/react-theme-provider, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8" from @react-native-community/async-storage@1.12.1
npm WARN node_modules/sync-storage/node_modules/@react-native-community/async-storage
npm WARN   @react-native-community/async-storage@"^1.6.3" from sync-storage@0.4.2
npm WARN   node_modules/sync-storage
npm WARN
npm WARN Conflicting peer dependency: react@16.14.0
npm WARN node_modules/react
npm WARN   peer react@"^16.8" from @react-native-community/async-storage@1.12.1
npm WARN   node_modules/sync-storage/node_modules/@react-native-community/async-storage
npm WARN     @react-native-community/async-storage@"^1.6.3" from sync-storage@0.4.2
npm WARN     node_modules/sync-storage
npm WARN deprecated deep-assign@3.0.0: Check out `lodash.merge` or `merge-options` instead.
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated @babel/plugin-proposal-optional-catch-binding@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-catch-binding instead.
npm WARN deprecated @babel/plugin-proposal-numeric-separator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
npm WARN deprecated @babel/plugin-proposal-export-namespace-from@7.18.9: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-export-namespace-from instead.
npm WARN deprecated @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
npm WARN deprecated @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
npm WARN deprecated @babel/plugin-proposal-object-rest-spread@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.
npm WARN deprecated @babel/plugin-proposal-async-generator-functions@7.20.7: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-async-generator-functions instead.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
npm WARN deprecated @react-native-community/async-storage@1.12.1: Async Storage has moved to new organization: https://github.com/react-native-async-storage/async-storage

added 2007 packages, and audited 2008 packages in 1m

215 packages are looking for funding
  run `npm fund` for details

21 vulnerabilities (2 moderate, 19 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

❌ Build expo project:

PS C:\Papillon> npm run android

> papillonvex@6.6.6 android
> expo run:android

› Building app...
Configuration on demand is an incubating feature.

> Configure project :app
 ??  Applying gradle plugin 'expo-dev-launcher-gradle-plugin' (expo-dev-launcher@3.3.0)

> Configure project :notifee_react-native
:notifee_react-native @notifee/react-native found at C:\Papillon\node_modules\@notifee\react-native
:notifee_react-native package.json found at C:\Papillon\node_modules\@notifee\react-native\package.json
:notifee_react-native:version set from package.json: 7.8.2 (7,8,2 - 7008002)
:notifee_react-native:android.compileSdk using custom value: 33
:notifee_react-native:android.targetSdk using custom value: 33
:notifee_react-native:android.minSdk using custom value: 21
:notifee_react-native:reactNativeAndroidDir C:\Papillon\node_modules\react-native\android

> Configure project :expo

Using expo modules
  - legeek01-expo-in-app-purchases (1.0.0)
  - pchmn-expo-material3-theme (1.3.1)
  - expo-application (5.3.1)
  - expo-background-fetch (11.3.0)
  - expo-barcode-scanner (12.5.3)
  - expo-blur (12.4.1)
  - expo-calendar (11.3.2)
  - expo-clipboard (4.3.1)
  - expo-constants (14.4.2)
  - expo-crypto (12.4.1)
  - expo-dev-client (2.4.11)
  - expo-dev-launcher (3.3.0)
  - expo-dev-menu (3.2.1)
  - expo-device (5.4.0)
  - expo-document-picker (11.5.4)
  - expo-dynamic-app-icon (1.2.0)
  - expo-file-system (15.4.4)
  - expo-font (11.4.0)
  - expo-haptics (12.4.0)
  - expo-image-loader (4.3.0)
  - expo-image-picker (14.3.2)
  - expo-json-utils (0.7.1)
  - expo-keep-awake (12.3.0)
  - expo-linear-gradient (12.3.0)
  - expo-local-authentication (13.4.1)
  - expo-location (16.1.0)
  - expo-manifests (0.7.2)
  - expo-modules-core$android-annotation (1.5.11)
  - expo-modules-core (1.5.11)
  - expo-modules-core$android-annotation-processor (1.5.11)
  - expo-navigation-bar (2.3.0)
  - expo-notifications (0.20.1)
  - expo-sharing (11.5.0)
  - expo-splash-screen (0.20.5)
  - expo-store-review (6.4.0)
  - expo-system-ui (2.4.0)
  - expo-task-manager (11.3.0)
  - expo-web-browser (12.3.2)
  - unimodules-app-loader (4.2.0)

> Configure project :react-native-reanimated
No AAR for react-native-reanimated found. Attempting to build from source.
Android gradle plugin: 7.4.2
Gradle: 8.0.1
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not find any matches for app.notifee:core:+ as no versions of app.notifee:core are available.
     Searched in the following locations:
       - file:/C:/Papillon/node_modules/react-native/android/app/notifee/core/maven-metadata.xml
       - file:/C:/Papillon/node_modules/jsc-android/dist/app/notifee/core/maven-metadata.xml
       - https://dl.google.com/dl/android/maven2/app/notifee/core/maven-metadata.xml
       - https://repo.maven.apache.org/maven2/app/notifee/core/maven-metadata.xml
       - https://www.jitpack.io/app/notifee/core/maven-metadata.xml
       - https://oss.sonatype.org/content/repositories/snapshots/app/notifee/core/maven-metadata.xml
     Required by:
         project :app > project :notifee_react-native

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 56s
10 actionable tasks: 10 up-to-date
Error: C:\Papillon\android\gradlew.bat exited with non-zero code: 1
Error: C:\Papillon\android\gradlew.bat exited with non-zero code: 1
    at ChildProcess.completionListener (C:\Papillon\node_modules\@expo\spawn-async\build\spawnAsync.js:52:23)
    at Object.onceWrapper (node:events:629:26)
    at ChildProcess.emit (node:events:514:28)
    at cp.emit (C:\Papillon\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5)
    ...
    at Object.spawnAsync [as default] (C:\Papillon\node_modules\@expo\spawn-async\build\spawnAsync.js:17:21)
    at spawnGradleAsync (C:\Papillon\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:72:46)
    at Object.assembleAsync (C:\Papillon\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:52:18)
    at runAndroidAsync (C:\Papillon\node_modules\@expo\cli\build\src\run\android\runAndroidAsync.js:36:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Slysoks commented 1 month ago

Vous utilisez quelle version du SDK d'Android ? Pour ma part la 35

LeGeek01 commented 1 month ago

essaie un coup de prebuild npx expo prebuild

LeGeek01 commented 1 month ago

après moi la commande que je faisais pour build un apk c'était npx expo run:android --no-bundler --no-install --variant release

Slysoks commented 1 month ago

Je n'y arrive toujours pas, ça me donne la même erreur malgré avoir tout essayé. Apparement c'est à cause de notifee-react-native

Slysoks commented 1 month ago

J'ai réussi à avancer dans le build en ajoutant la librairie notifee-react-native dans le build.gradle ce qui me donne ce fichier :

[...]
allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))
        }
        maven {
            // Android JSC is installed from npm
            url(new File(['node', '--print', "require.resolve('jsc-android/package.json')"].execute(null, rootDir).text.trim(), '../dist'))
        }

        google()
        mavenCentral()
        maven { url 'https://www.jitpack.io' }
        maven { url("$rootDir/../node_modules/@notifee/react-native/android/libs") }
    }
}

J'ai ajouté le mavenLocal() et dcp le maven { url("$rootDir/../node_modules/@notifee/react-native/android/libs") } et maintenant le build est réussi. Mais qui dit problème réglé dit nouveau problème !!

Visiblement un tout petit problème mais je n'arrive pas à savoir comment le régler...

Error: adb: failed to install C:\Papillon\android\app\build\outputs\apk\debug\app-debug.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE: Downgrade detected: Update version code 1 is older than current 6660]
LeGeek01 commented 1 month ago

Ça c'est parce que tu as la version officielle d'installée, et que tu n'as pas changé le version code qui est à 1, donc Android refuse l'installation car il croit à un downgrade

Le mieux à faire c'est de changer le package name, parce que sinon android va te refuser l'installation à cause de la signature de l'appli qui ne correspond pas (ou alors tu désinstalle la version que tu as)

Slysoks commented 1 month ago

Merci ! Vraiment la commu open source c'est une pépite !!