Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on running react-native project : MainApplication.java:5: error: cannot find symbol import com.facebook.react.ReactApplication; #22033

Closed
deepak-shah-np opened this issue Oct 31, 2018 · 36 comments
Labels
Bug Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@deepak-shah-np
Copy link

deepak-shah-np commented Oct 31, 2018

I have created project using expo ie expo init helloworld
then ejected it using expo eject.

And then I tried to run in emulator with yarn run android .
I got the following error.

$ yarn run android
yarn run v1.3.2
$ react-native run-android
Scanning folders for symlinks in D:\gajurlab\helloworld\node_modules (25ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee081Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore081Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco081Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline081Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp081Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0201Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
D:\gajurlab\helloworld\android\app\src\main\java\com\mynewproject\MainApplication.java:5: error: cannot find symbol
import com.facebook.react.ReactApplication;
^
symbol: class ReactApplication
location: package com.facebook.react
D:\gajurlab\helloworld\android\app\src\main\java\com\mynewproject\MainApplication.java:6: error: cannot find symbol
import com.facebook.react.ReactNativeHost;
^
symbol: class ReactNativeHost
location: package com.facebook.react
D:\gajurlab\helloworld\android\app\src\main\java\com\mynewproject\MainApplication.java:14: error: cannot find symbol
public class MainApplication extends Application implements ReactApplication {
^
symbol: class ReactApplication
D:\gajurlab\helloworld\android\app\src\main\java\com\mynewproject\MainApplication.java:16: error: cannot find symbol
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
^
symbol: class ReactNativeHost
location: class MainApplication
D:\gajurlab\helloworld\android\app\src\main\java\com\mynewproject\MainApplication.java:36: error: cannot find symbol
public ReactNativeHost getReactNativeHost() {
^
symbol: class ReactNativeHost
location: class MainApplication
D:\gajurlab\helloworld\android\app\src\main\java\com\mynewproject\MainActivity.java:5: error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActivi
ty
public class MainActivity extends ReactActivity {
^
D:\gajurlab\helloworld\android\app\src\main\java\com\mynewproject\MainApplication.java:16: error: cannot find symbol
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
^
symbol: class ReactNativeHost
location: class MainApplication
D:\gajurlab\helloworld\android\app\src\main\java\com\mynewproject\MainApplication.java:35: error: method does not override or implement a method from a supertype
@OverRide
^
8 errors
:app:compileDebugJavaWithJavac FAILED

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.

BUILD FAILED

Total time: 9.46 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Done in 12.38s.

Info

$ react-native info
Scanning folders for symlinks in D:\gajurlab\helloworld\node_modules (25ms)

Environment:
OS: Windows 8.1
Node: 8.9.4
Yarn: 1.3.2
npm: 5.6.0
Watchman: Not Found
Xcode: N/A
Android Studio: Version 3.1.0.0 AI-173.4720617

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz => 0.55.4

@ddudek
Copy link

ddudek commented Nov 1, 2018

I have the same issue. Seems like "android" folder is missing referenced here:

maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url "$rootDir/../node_modules/react-native/android"
    }

@happy32x
Copy link

happy32x commented Nov 3, 2018

same problem here ... please help us

@mariano55555
Copy link

I have the same problem...and I looked into node_modules/react-native and there is no "android" folder like it used to be in previous version, did you find any solution?

@phorvicheka
Copy link

phorvicheka commented Nov 22, 2018

I solved it by:
change the line below in android/app/build.gradle file from
implementation "com.facebook.react:react-native:+" // From node_modules
to specific version of my react-native as in package.json
implementation "com.facebook.react:react-native:0.57.5" // From node_modules

image

@imerkle
Copy link

imerkle commented Nov 30, 2018

@phorvicheka doesnt works


Could not find com.facebook.react:react-native:0.57.1.
  Searched in the following locations:
      file:/home/username/Android/Sdk/extras/m2repository/com/facebook/react/react-native/0.57.1/react-native-0.57.1.pom

Edit

This was the reason
#21722 (comment)

@brien-givens
Copy link

I had the same problem - adding the following block to allprojects.repositories in the project's build.gradle fixed it for me:

maven {
    url "$rootDir/../node_modules/react-native/android"
}

Versions
Android Studio: 3.4 Canary 10
gradle: 5.1
react-navive: 0.57.8

@chriseteka
Copy link

I have the same problem, and i have tried suggested solutions here and even in stack overflow, but none worked for me. Also i couldn't find "android" folder in node_modules/react-native folder

@mariano55555
Copy link

At the end, I stopped trying using expo and then eject the app, instead of that, I used the option "Build Projects with native code" from React Native official page, https://facebook.github.io/react-native/docs/getting-started...and It worked like expected

@Mohit-gwg
Copy link

I also have same problem. I follow all the suggestions which are provided here.
@brien-givens "allprojects.repositories" is already present in my build.gradle. Please suggest.

@5h4thru
Copy link

5h4thru commented Jan 29, 2019

I do not find 'android' folder under node_modules/react-native.
Running npm: 6.7.0 and node: v11.8.0
I see ReactAndroid folder under $rootDir/../node_modules/react-native/. Perhaps update it in build.gradle?

@kelset kelset added the Platform: Android Android applications. label Jan 29, 2019
@samernady
Copy link

Any update on this?

@gtebbutt
Copy link
Contributor

gtebbutt commented Feb 1, 2019

Just updated from 0.57.8 to the latest version - I'm seeing the same issue, but can build by replacing implementation "com.facebook.react:react-native:+" with implementation "com.facebook.react:react-native:0.58.3"

@gtebbutt
Copy link
Contributor

gtebbutt commented Feb 1, 2019

OK, I've figured out the problem, at least in my case.

Running ./gradlew app:dependencies shows that react-native-sound specifies an ancient RN version, and that's taking precedence.

What I can't work out is why it resolves correctly if I go back to the commit before the upgrade:

+--- project :react-native-sound
|    \--- com.facebook.react:react-native:0.12.+ -> 0.57.8 (*)
+--- project :react-native-sound
|    \--- com.facebook.react:react-native:0.12.+ -> 0.12.0 (*)

Maybe a change in resolution rules on the newer gradle version that ships with 0.58?

@Juman8
Copy link

Juman8 commented Feb 13, 2019

I had the same problem, follow the link: node_modules/react-native/android/com.facebbok.react/react-native.
You can see the react-native version.
after: change (build.gradle(app)):
(implementation "com.facebook.react:react-native:+") -> (implementation "com.facebook.react:react-native:0.58.4")
My version: 0.58.4
it worked for me.

@ChaabaneFahmi
Copy link

didn't work for me..
first of all i couldn't find android folder inside react-native
second, it kept telling me this

Could not find com.facebook.react:react-native:0.57.1. Searched in the following locations: file:/C:/Users/Fahmy/AppData/Local/Android/Sdk/extras/m2repository/com/facebook/react/react-native/0.57.1/react-native-0.57.1.pom file:/C:/Users/Fahmy/AppData/Local/Android/Sdk/extras/m2repository/com/facebook/react/react-native/0.57.1/react-native-0.57.1.jar file:/C:/Users/Fahmy/AppData/Local/Android/Sdk/extras/google/m2repository/com/facebook/react/react-native/0.57.1/react-native-0.57.1.pom file:/C:/Users/Fahmy/AppData/Local/Android/Sdk/extras/google/m2repository/com/facebook/react/react-native/0.57.1/react-native-0.57.1.jar file:/C:/Users/Fahmy/AppData/Local/Android/Sdk/extras/android/m2repository/com/facebook/react/react-native/0.57.1/react-native-0.57.1.pom file:/C:/Users/Fahmy/AppData/Local/Android/Sdk/extras/android/m2repository/com/facebook/react/react-native/0.57.1/react-native-0.57.1.jar file:/C:/Users/Fahmy/.m2/repository/com/facebook/react/react-native/0.57.1/react-native-0.57.1.pom file:/C:/Users/Fahmy/.m2/repository/com/facebook/react/react-native/0.57.1/react-native-0.57.1.jar https://jcenter.bintray.com/com/facebook/react/react-native/0.57.1/react-native-0.57.1.pom https://jcenter.bintray.com/com/facebook/react/react-native/0.57.1/react-native-0.57.1.jar file:/C:/Users/Fahmy/Desktop/dex_Spring/maxApp/node_modules/react-native/android/com/facebook/react/react-native/0.57.1/react-native-0.57.1.pom file:/C:/Users/Fahmy/Desktop/dex_Spring/maxApp/node_modules/react-native/android/com/facebook/react/react-native/0.57.1/react-native-0.57.1.jar https://dl.google.com/dl/android/maven2/com/facebook/react/react-native/0.57.1/react-native-0.57.1.pom https://dl.google.com/dl/android/maven2/com/facebook/react/react-native/0.57.1/react-native-0.57.1.jar Required by: project :app

@johnopthof
Copy link

Same as ChaabaneFahmi for me!

@lucasSndr
Copy link

Same here. No android folder in react-native/
Java compiler displays : cannot find symbol class ReactApplication and cannot find symbol ReactNativeHost.

Any update ?

@IvanAllue
Copy link

In my case:

react-native link --> solved the error.
If when you do it you get problems with the glob run first:
npm install --save glob

@aronedwards91
Copy link

aronedwards91 commented Jul 19, 2019

Getting very similar error within packageList (also get in MainApplication if link in there):

--/proj/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:75: error: cannot find symbol
      new AppCenterReactNativePackage(MainApplication.this),
                                      ^
  symbol:   class MainApplication
  location: class PackageList
--/proj/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:76: error: cannot find symbol
      new AppCenterReactNativeAnalyticsPackage(MainApplication.this, getResources().getString(R.string.appCenterAnalytics_whenToEnableAnalytics)),
                                               ^
  symbol:   class MainApplication
  location: class PackageList
--/proj/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:77: error: cannot find symbol
      new AppCenterReactNativeCrashesPackage(MainApplication.this, getResources().getString(R.string.appCenterCrashes_whenToSendCrashes)),
                                             ^
  symbol:   class MainApplication
  location: class PackageList
3 errors

(For now removed as not essential)

@IvanAllue
Copy link

After many attempts, this error came back to me all the time, I created new projects and nothing. At the end I saw in a video that instead of using expo eject they used the command react-native eject.

It seemed silly but I tried it and it seems that I must work in another way since I managed to make the mistake. I wanted to do the eject to work with realm and I got it installed and it worked ^^

Sorry if you do not understand, use google translator.

Summary use react-native eject instead of expo eject. Good luck

@vgvishal538
Copy link

@aronedwards91 did you find any solution?

@wmonecke
Copy link

wmonecke commented Aug 3, 2019

I don't know if I'm the only one but my error looks like this:

> Task :app:compileReleaseJavaWithJavac FAILED
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/MainApplication.java:5: error: package android.support.multidex does not exist
import android.support.multidex.MultiDexApplication;
                               ^
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/MainApplication.java:7: error: cannot find symbol
import com.facebook.react.PackageList;
                         ^
  symbol:   class PackageList
  location: package com.facebook.react
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/MainApplication.java:41: error: cannot find symbol
public class MainApplication extends MultiDexApplication implements ReactApplication {
                                     ^
  symbol: class MultiDexApplication
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/SplashActivity.java:5: error: package android.support.v7.app does not exist
import android.support.v7.app.AppCompatActivity;
                             ^
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/SplashActivity.java:7: error: cannot find symbol
public class SplashActivity extends AppCompatActivity {
                                    ^
  symbol: class AppCompatActivity
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/MainApplication.java:43: error: incompatible types: MainApplication cannot be converted to Application
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                                                                       ^
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/MainApplication.java:52: error: cannot find symbol
      List<ReactPackage> packages = new PackageList(this).getPackages();
                                        ^
  symbol: class PackageList
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/MainApplication.java:54: error: no suitable method found for add(SvgPackage,RNFSPackage,RNDeviceInfo,PickerPackage,RNSentryPackage,RNLocationPackage,ReactVideoPackage,RNFirebasePackage,RNFetchBlobPackage,VectorIconsPackage,RNGooglePlacesPackage,RNFirebaseAuthPackage,LinearGradientPackage,RNGoogleSigninPackage,RNFirebaseAdMobPackage,SplashScreenReactPackage,RNFirebaseFirestorePackage,RNFirebaseMessagingPackage,RNFirebaseNotificationsPackage,ReactNativeLocalizationPackage)
      packages.add(
              ^
    method Collection.add(ReactPackage) is not applicable
      (actual and formal argument lists differ in length)
    method List.add(ReactPackage) is not applicable
      (actual and formal argument lists differ in length)
    method List.add(int,ReactPackage) is not applicable
      (actual and formal argument lists differ in length)
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/MainApplication.java:43: error: cannot find symbol
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                                                   ^
  symbol: constructor (MainApplication)
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/MainApplication.java:90: error: method does not override or implement a method from a supertype
  @Override
  ^
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/MainApplication.java:92: error: cannot find symbol
    super.onCreate();
    ^
  symbol:   variable super
  location: class MainApplication
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/MainApplication.java:93: error: cannot find symbol
    AppEventsLogger.activateApp(this);
    ^
  symbol:   variable AppEventsLogger
  location: class MainApplication
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/MainApplication.java:94: error: no suitable method found for init(MainApplication,boolean)
    SoLoader.init(this, /* native exopackage */ false);
            ^
    method SoLoader.init(Context,int) is not applicable
      (argument mismatch; MainApplication cannot be converted to Context)
    method SoLoader.init(Context,boolean) is not applicable
      (argument mismatch; MainApplication cannot be converted to Context)
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/MainActivity.java:13: error: cannot find symbol
        MainApplication.getCallbackManager().onActivityResult(requestCode, resultCode, data);
                       ^
  symbol:   method getCallbackManager()
  location: class MainApplication
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/SplashActivity.java:8: error: method does not override or implement a method from a supertype
  @Override
  ^
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/SplashActivity.java:10: error: cannot find symbol
    super.onCreate(savedInstanceState);
    ^
  symbol:   variable super
  location: class SplashActivity
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/SplashActivity.java:12: error: no suitable constructor found for Intent(SplashActivity,Class<MainActivity>)
    Intent intent = new Intent(this, MainActivity.class);
                    ^
    constructor Intent.Intent(String,Uri) is not applicable
      (argument mismatch; SplashActivity cannot be converted to String)
    constructor Intent.Intent(Context,Class<?>) is not applicable
      (argument mismatch; SplashActivity cannot be converted to Context)
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/SplashActivity.java:13: error: cannot find symbol
    startActivity(intent);
    ^
  symbol:   method startActivity(Intent)
  location: class SplashActivity
/Users/waltermonecke/Documents/Code/React-Native2/moodPixel/android/app/src/main/java/com/moodpixel/SplashActivity.java:14: error: cannot find symbol
    finish();
    ^
  symbol:   method finish()
  location: class SplashActivity
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
19 errors

@SubashManian
Copy link

i also getting error while build android package error

Task :app:compileDebugJavaWithJavac FAILED
/Users/laptop-obs-31/subash/Projects/pharmabox/15:7:19/android/app/src/main/java/com/pharmabox/MainApplication.java:5: error: cannot find symbol
import com.airbnb.android.react.lottie.LottiePackage;
^
symbol: class LottiePackage
location: package com.airbnb.android.react.lottie
/Users/laptop-obs-31/subash/Projects/pharmabox/15:7:19/android/app/src/main/java/com/pharmabox/MainApplication.java:11: error: cannot find symbol
import com.oblador.vectoricons.VectorIconsPackage;
^
symbol: class VectorIconsPackage
location: package com.oblador.vectoricons
/Users/laptop-obs-31/subash/Projects/pharmabox/15:7:19/android/app/src/main/java/com/pharmabox/MainApplication.java:12: error: cannot find symbol
import com.reactnative.ivpusic.imagepicker.PickerPackage;
^
symbol: class PickerPackage
location: package com.reactnative.ivpusic.imagepicker
/Users/laptop-obs-31/subash/Projects/pharmabox/15:7:19/android/app/src/main/java/com/pharmabox/MainApplication.java:13: error: cannot find symbol
import com.reactnativecommunity.netinfo.NetInfoPackage;
^
symbol: class NetInfoPackage
location: package com.reactnativecommunity.netinfo
/Users/laptop-obs-31/subash/Projects/pharmabox/15:7:19/android/app/src/main/java/com/pharmabox/MainApplication.java:14: error: cannot find symbol
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
^
symbol: class RNGestureHandlerPackage
location: package com.swmansion.gesturehandler.react
/Users/laptop-obs-31/subash/Projects/pharmabox/15:7:19/android/app/src/main/java/com/pharmabox/MainActivity.java:6: error: cannot find symbol
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
^
symbol: class RNGestureHandlerEnabledRootView
location: package com.swmansion.gesturehandler.react
/Users/laptop-obs-31/subash/Projects/pharmabox/15:7:19/android/app/src/main/java/com/pharmabox/MainApplication.java:31: error: cannot find symbol
packages.add(new NetInfoPackage());
^
symbol: class NetInfoPackage
/Users/laptop-obs-31/subash/Projects/pharmabox/15:7:19/android/app/src/main/java/com/pharmabox/MainApplication.java:32: error: cannot find symbol
packages.add(new LottiePackage());
^
symbol: class LottiePackage
/Users/laptop-obs-31/subash/Projects/pharmabox/15:7:19/android/app/src/main/java/com/pharmabox/MainApplication.java:33: error: cannot find symbol
packages.add(new RNGestureHandlerPackage());
^
symbol: class RNGestureHandlerPackage
/Users/laptop-obs-31/subash/Projects/pharmabox/15:7:19/android/app/src/main/java/com/pharmabox/MainApplication.java:34: error: cannot find symbol
packages.add(new PickerPackage());
^
symbol: class PickerPackage
/Users/laptop-obs-31/subash/Projects/pharmabox/15:7:19/android/app/src/main/java/com/pharmabox/MainApplication.java:35: error: cannot find symbol
packages.add(new VectorIconsPackage());
^
symbol: class VectorIconsPackage
/Users/laptop-obs-31/subash/Projects/pharmabox/15:7:19/android/app/src/main/java/com/pharmabox/MainActivity.java:24: error: cannot find symbol
return new RNGestureHandlerEnabledRootView(MainActivity.this);
^
symbol: class RNGestureHandlerEnabledRootView
12 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 22s
82 actionable tasks: 2 executed, 80 up-to-date

@juroMin
Copy link

juroMin commented Aug 13, 2019

I'm having this error:

android/app/src/main/java/com/emphy/MainApplication.java:7: error: cannot find symbol
import com.facebook.react.PackageList;
                         ^
  symbol:   class PackageList
  location: package com.facebook.react
/Users/irynapolishchuk/mobile/android/app/src/main/java/com/emphy/MainApplication.java:45: error: cannot find symbol
      List<ReactPackage> packages = new PackageList(this).getPackages();
                                        ^
  symbol: class PackageList
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDevDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.4 => 0.60.4
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

[email protected]
└── @react-native-community/[email protected]

com.android.tools.build:gradle:3.4.1

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+"
....
}

I've been updating RN 0.55.4 -> 0.60.4

@ckOfor
Copy link

ckOfor commented Aug 21, 2019

@juroMin me too, any fix?

@abhirup03
Copy link

I am too facing a similar issue.. while upgrading my app from RN 0.57 to RN 0.60. After making
required changes to the packages, all I see is this:
Screen Shot 2019-08-22 at 11 24 35 AM

@basha777
Copy link

basha777 commented Sep 5, 2019

I'm having this error:

android/app/src/main/java/com/emphy/MainApplication.java:7: error: cannot find symbol
import com.facebook.react.PackageList;
                         ^
  symbol:   class PackageList
  location: package com.facebook.react
/Users/irynapolishchuk/mobile/android/app/src/main/java/com/emphy/MainApplication.java:45: error: cannot find symbol
      List<ReactPackage> packages = new PackageList(this).getPackages();
                                        ^
  symbol: class PackageList
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDevDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.4 => 0.60.4
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

[email protected]
└── @react-native-community/[email protected]

com.android.tools.build:gradle:3.4.1

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+"
....
}

I've been updating RN 0.55.4 -> 0.60.4

facing same issue while upgrade from RN 0.59.9 to 0.60.5.

@SameeraMadushan
Copy link

I'm having this error:

android/app/src/main/java/com/emphy/MainApplication.java:7: error: cannot find symbol
import com.facebook.react.PackageList;
                         ^
  symbol:   class PackageList
  location: package com.facebook.react
/Users/irynapolishchuk/mobile/android/app/src/main/java/com/emphy/MainApplication.java:45: error: cannot find symbol
      List<ReactPackage> packages = new PackageList(this).getPackages();
                                        ^
  symbol: class PackageList
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDevDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.4 => 0.60.4
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

[email protected]
└── @react-native-community/[email protected]

com.android.tools.build:gradle:3.4.1

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+"
....
}

I've been updating RN 0.55.4 -> 0.60.4

having the same issue while upgrade from RN 0.59 to 0.60

@juroMin were you able to find any solution?

@basha777
Copy link

basha777 commented Sep 5, 2019

while upgrading to from RN 0.59.9 to 0.60.5 using https://react-native-community.github.io/upgrade-helper/?from=0.59.9&to=0.60.5 i forgot to make changes in android/app/build.gradle file, after making the following changes my issue was solved
Note: by default android/app/build.gradle is not expanded.

@ckOfor
Copy link

ckOfor commented Sep 5, 2019

@basha777 try adding to the bottom of your app/build.gradle

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle")
applyNativeModulesAppBuildGradle(project)

@basha777
Copy link

basha777 commented Sep 5, 2019

@basha777 try adding to the bottom of your app/build.gradle

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle")
applyNativeModulesAppBuildGradle(project)

@ckOfor my issue is solved now.

@basha777
Copy link

basha777 commented Sep 5, 2019

I'm having this error:

android/app/src/main/java/com/emphy/MainApplication.java:7: error: cannot find symbol
import com.facebook.react.PackageList;
                         ^
  symbol:   class PackageList
  location: package com.facebook.react
/Users/irynapolishchuk/mobile/android/app/src/main/java/com/emphy/MainApplication.java:45: error: cannot find symbol
      List<ReactPackage> packages = new PackageList(this).getPackages();
                                        ^
  symbol: class PackageList
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDevDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.4 => 0.60.4
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
[email protected]
└── @react-native-community/[email protected]
com.android.tools.build:gradle:3.4.1
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+"
....
}
I've been updating RN 0.55.4 -> 0.60.4

having the same issue while upgrade from RN 0.59 to 0.60

@juroMin were you able to find any solution?

@SameeraMadushan refer my comment

@changweining
Copy link

while upgrading to from RN 0.59.9 to 0.60.5 using https://react-native-community.github.io/upgrade-helper/?from=0.59.9&to=0.60.5 i forgot to make changes in android/app/build.gradle file, after making the following changes my issue was solved
Note: by default android/app/build.gradle is not expanded.

@runryan
Copy link

runryan commented Nov 22, 2019

In my case, the problem is solved by appending apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) at the bottom of android/app/build.gradle.

@stale
Copy link

stale bot commented Feb 20, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 20, 2020
@stale
Copy link

stale bot commented Feb 27, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Feb 27, 2020
@facebook facebook locked as resolved and limited conversation to collaborators Feb 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests