expo-cli icon indicating copy to clipboard operation
expo-cli copied to clipboard

Ejected expo project does not run

Open lucassouza16 opened this issue 6 years ago • 13 comments

I already had a pre-created expo project, after upgrading to sdk 38 and performing the eject expo it does not run android yarn, it just gives an error and closes, I already fixed the import of this class in mainactivity, but even so it does not run, the app opens and then immediately closes, I've updated the expo-cli globally, the node and even then the error persists. Capturar

lucassouza16 avatar Jul 23 '20 13:07 lucassouza16

hi there! we need more details. here is a log of running initializing a project, ejecting it, and building and running it on android: https://gist.github.com/brentvatne/c624131bbcb9a5044cc31cf5f093be6f

can you share your project or a mcve?

brentvatne avatar Jul 23 '20 18:07 brentvatne

Olá! precisamos de mais detalhes. aqui está um log de execução inicializando um projeto, ejetando-o e construindo e executando-o no android: https://gist.github.com/brentvatne/c624131bbcb9a5044cc31cf5f093be6f

você pode compartilhar seu projeto ou um mcve ?

Microsoft Windows [versão 6.1.7601] Copyright (c) 2009 Microsoft Corporation. Todos os direitos reservados.

C:\xampp\htdocs\MyVendas_Expo>expo eject

Cannot determine which native SDK version your project uses because the module expo is not installed. Please install it with yarn add expo and try again.

C:\xampp\htdocs\MyVendas_Expo>npm install

[email protected] postinstall C:\xampp\htdocs\MyVendas_Expo\node_modules\core-js node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:

https://opencollective.com/core-js https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 882 packages from 458 contributors and audited 886 packages in 277.005s

13 packages are looking for funding run npm fund for details

found 43 low severity vulnerabilities run npm audit fix to fix them, or npm audit for details

C:\xampp\htdocs\MyVendas_Expo>expo eject Your git working tree is clean To revert the changes after this command completes, you can run the following: git clean --force && git reset --hard

Now we need to know your iOS bundle identifier (​https://expo.fyi/bundle-identifier​). You can change this in the future if you need to.

? What would you like your iOS bundle identifier to be? com.ico.app.myvendas

Your iOS bundle identifier is now: com.ico.app.myvendas

√ App configuration (app.json) updated. √ Created native project directories (./ios and ./android) and updated .gitignore. √ Added Metro bundler configuration. √ Updated package.json and added index.js entry point for iOS and Android. √ Installed JavaScript dependencies.

⚠️ iOS configuration applied with warnings that should be fixed:

  • supportsTablet: You will need to configure this in the "General" tab for your project target in Xcode.
  • icon: This is the image that your app uses on your home screen, you will need to configure it manually.
  • splash: This is the image that your app uses on the loading screen, we recommend installing and using expo-splash-screen. Details. (​https://github.com/expo/expo/ blob/master/packages/expo-splash-screen/README.md​)

⚠️ Android configuration applied with warnings that should be fixed:

  • splash: This is the image that your app uses on the loading screen, we recommend installing and using expo-splash-screen. Details. (​https://github.com/expo/expo/ blob/master/packages/expo-splash-screen/README.md​)
  • icon: This is the image that your app uses on your home screen, you will need to configure it manually.

√ Skipped installing CocoaPods because operating system is not on macOS.

➡️ Next steps

  • � Review the logs above and look for any warnings (⚠️ ) that might need follow-up.
  • � You may want to run npx @react-native-community/cli doctor to help install any tools that your app may need to run your native projects.
  • � When CocoaPods is installed, initialize the project workspace: cd ios && pod install
  • � Download your Android keystore (if you're not sure if you need to, just run the command and see): expo fetch:android:keystore

☑️ When you are ready to run your project To compile and run your project in development, execute one of the following commands:

  • yarn ios
  • yarn android
  • yarn web

C:\xampp\htdocs\MyVendas_Expo>yarn android

yarn run v1.19.1 $ react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 1491 file(s) to forward-jetify. Using 2 workers... info Starting JS server... info Installing the app...

Configure project :app

Installing unimodules: [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules@unimodules\core [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules@unimodules\react-native-adapter [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\expo-constants [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\expo-error-recovery [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\expo-file-system [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\expo-font [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\expo-image-loader [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\expo-keep-awake [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\expo-linear-gradient [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\expo-location [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\expo-permissions [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\expo-splash-screen [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\expo-sqlite [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\expo-updates [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\unimodules-app-loader [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\unimodules-barcode-scanner-interface [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\unimodules-camera-interface [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\unimodules-constants-interface [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\unimodules-face-detector-interface [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\unimodules-file-system-interface [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\unimodules-font-interface [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\unimodules-image-loader-interface [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\unimodules-permissions-interface [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\unimodules-sensors-interface [email protected] from C:\xampp\htdocs\MyVendas_Expo\node_modules\unimodules-task-manager-interface

Task :app:processDebugManifest C:\xampp\htdocs\MyVendas_Expo\android\app\src\debug\AndroidManifest.xml:18:9-27:20 Warning: provider#expo.modules.filesystem.FileSystemFileProvider@android:authorities was tagged at AndroidManifest.xml:18 to replace other declarations but no other declaration present

Task :app:compileDebugJavaWithJavac

Task :app:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings 436 actionable tasks: 4 executed, 432 up-to-date C:\xampp\htdocs\MyVendas_Expo\android\app\src\main\java\com\myvendas\MainApplication.java:39: error: cannot find symbol return BuildConfig.DEBUG; ^ symbol: variable BuildConfig C:\xampp\htdocs\MyVendas_Expo\android\app\src\main\java\com\myvendas\MainApplication.java:56: error: cannot find symbol if (BuildConfig.DEBUG) { ^ symbol: variable BuildConfig C:\xampp\htdocs\MyVendas_Expo\android\app\src\main\java\com\myvendas\MainApplication.java:56: error: illegal parenthesized expression if (BuildConfig.DEBUG) { ^ C:\xampp\htdocs\MyVendas_Expo\android\app\src\main\java\com\myvendas\MainApplication.java:65: error: cannot find symbol if (BuildConfig.DEBUG) { ^ symbol: variable BuildConfig C:\xampp\htdocs\MyVendas_Expo\android\app\src\main\java\com\myvendas\MainApplication.java:65: error: illegal parenthesized expression if (BuildConfig.DEBUG) { ^ C:\xampp\htdocs\MyVendas_Expo\android\app\src\main\java\com\myvendas\MainApplication.java:83: error: cannot find symbol if (!BuildConfig.DEBUG) { ^ symbol: variable BuildConfig location: class MainApplication C:\xampp\htdocs\MyVendas_Expo\android\app\src\main\java\com\myvendas\MainApplication.java:99: error: cannot find symbol if (BuildConfig.DEBUG) { ^ symbol: variable BuildConfig location: class MainApplication C:\xampp\htdocs\MyVendas_Expo\android\app\src\main\java\com\myvendas\MainApplication.java:99: error: illegal parenthesized expression if (BuildConfig.DEBUG) { ^ Note: C:\xampp\htdocs\MyVendas_Expo\android\app\src\debug\java\com\myvendas\ReactNativeFlipper.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 8 errors

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • 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 3m 44s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 C:\xampp\htdocs\MyVendas_Expo\android\app\src\main\java\com\myvendas\MainApplication.java:39: error: cannot find symbol error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

C:\xampp\htdocs\MyVendas_Expo>

lucassouza16 avatar Jul 23 '20 18:07 lucassouza16

i need access to "MyVendas_Expo" or a project where this happens to better understand the issue

brentvatne avatar Jul 23 '20 18:07 brentvatne

i need access to "MyVendas_Expo" or a project where this happens to better understand the issue

Unfortunately I cannot provide access to the folder, but one thing I find strange is that MainActivity is being generated in a different directory than the package I defined Capturar my package is com.ico.app.myvendas

lucassouza16 avatar Jul 23 '20 19:07 lucassouza16

i need access to "MyVendas_Expo" or a project where this happens to better understand the issue

I managed to solve the problem by changing all imports, the files generated to the correct folder and the values ​​of the BUCK file to the correct name of my package, but it is quite strange that he generated these files in the wrong folder

lucassouza16 avatar Jul 23 '20 19:07 lucassouza16

@lucassouza16 - can you share your app.json?

brentvatne avatar Jul 23 '20 22:07 brentvatne

@lucassouza16 - can you share your app.json?

{
  "expo": {
    "name": "MyVendas",
    "slug": "MyVendas",
    "version": "1.0.9",
    "orientation": "default",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#007b5e"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.ico.app.myvendas"
    },
    "android": {
      "package": "com.ico.app.myvendas",
      "versionCode": 9,
      "permissions": []
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
    "entryPoint": "node_modules/expo/AppEntry.js"
  }
}

lucassouza16 avatar Jul 23 '20 22:07 lucassouza16

Cannot repro using the latest CLI

  • expo init my-app
  • expo eject
    • set package name to com.ico.app.myvendas
  • yarn android
  • builds as expected

EvanBacon avatar Sep 04 '20 15:09 EvanBacon

We are facing the same issue here.

image

dgellow avatar Sep 05 '20 13:09 dgellow

@dgellow - please share your project so we can attempt to reproduce this

brentvatne avatar Sep 09 '20 21:09 brentvatne

Closing as we cannot reproduce, please feel free to reopen with a reproducible demo.

EvanBacon avatar Nov 16 '20 17:11 EvanBacon

Hi, I've experienced this issue today.

I noticed that the eject command generated the BuildConfig.java file located in android/app/build/generated/source/buildConfig/debug/com/{app_identifier}/BuildConfig.java in the wrong place.

My app id has the pattern com.ab1234.myappname, but the eject command resolved the app identifier to com.myappname. This wrong app id pattern has been used to set the applicationId in android/app/build.gradle, in AndroidManifest.xml and to generate the BuildConfig.java file / folder structure.

I've managed to resolve this issue by moving the BuildConfig.java file from /debug/com/myappname/BuildConfig.java to /debug/com/ab1234/myappname/BuildConfig.java and update the app identifiers in this file to the com.ab1234.myappname format.

Edit: I am not entirely correct, as the BuildConfig.java file is generated 🤦. Verify your applicationId has been correctly set in app/build.gradle and AndroidManifest.xml, this was not the case for me.

IanOnFire avatar Dec 06 '21 14:12 IanOnFire

Olá, tive esse problema hoje.

Percebi que o comando ejetar gerou o BuildConfig.javaarquivo localizado no android/app/build/generated/source/buildConfig/debug/com/{app_identifier}/BuildConfig.javalocal errado.

Meu id de aplicativo tem o padrão com.ab1234.myappname, mas o comando de ejeção resolveu o identificador de aplicativo para com.myappname. Este padrão de id de aplicativo incorreto foi usado para definir applicationIdem android/app/build.gradle, em AndroidManifest.xml e para gerar a BuildConfig.javaestrutura de arquivo / pasta.

Consegui resolver esse problema movendo o BuildConfig.javaarquivo de /debug/com/myappname/BuildConfig.javapara /debug/com/ab1234/myappname/BuildConfig.javae atualizando os identificadores de aplicativo neste arquivo para o com.ab1234.myappnameformato.

Editar: não estou totalmente correto, pois o BuildConfig.javaarquivo é gerado 🤦. Verifique se o seu applicationId foi configurado corretamente em app/build.gradlee AndroidManifest.xml, este não foi o meu caso.

Hi, I've experienced this issue today.

I noticed that the eject command generated the BuildConfig.java file located in android/app/build/generated/source/buildConfig/debug/com/{app_identifier}/BuildConfig.java in the wrong place.

My app id has the pattern com.ab1234.myappname, but the eject command resolved the app identifier to com.myappname. This wrong app id pattern has been used to set the applicationId in android/app/build.gradle, in AndroidManifest.xml and to generate the BuildConfig.java file / folder structure.

I've managed to resolve this issue by moving the BuildConfig.java file from /debug/com/myappname/BuildConfig.java to /debug/com/ab1234/myappname/BuildConfig.java and update the app identifiers in this file to the com.ab1234.myappname format.

Edit: I am not entirely correct, as the BuildConfig.java file is generated 🤦. Verify your applicationId has been correctly set in app/build.gradle and AndroidManifest.xml, this was not the case for me.

Yes, it was the same solution I used to solve it in my case, I see that even after all this time they haven't solved a problem that seems to be so simple, I thought that by now they would have solved it.

lucassouza16 avatar Dec 06 '21 18:12 lucassouza16