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

build fails if run react-native link #3667

Closed
realabbas opened this issue Oct 26, 2019 · 5 comments
Closed

build fails if run react-native link #3667

realabbas opened this issue Oct 26, 2019 · 5 comments

Comments

@realabbas
Copy link

realabbas commented Oct 26, 2019

On windows machine I mistakenly ran react-native link , I encountered this problem.

> Task :react-native-screens:compileDebugJavaWithJavac FAILED
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\LifecycleHelper.java:3: error: package androidx.lifecycle does not exist
import androidx.lifecycle.Lifecycle;
                         ^
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\LifecycleHelper.java:4: error: package androidx.lifecycle does not exist
import androidx.lifecycle.LifecycleObserver;
                         ^
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\LifecycleHelper.java:5: error: package androidx.fragment.app does not exist
import androidx.fragment.app.Fragment;
                            ^
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\LifecycleHelper.java:17: error: cannot find symbol
  public static @Nullable Fragment findNearestScreenFragmentAncestor(View view) {
                          ^
  symbol:   class Fragment
  location: class LifecycleHelper
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\LifecycleHelper.java:28: error: cannot find symbol
  private Map<View, Lifecycle> mViewToLifecycleMap = new HashMap<>();
                    ^
  symbol:   class Lifecycle
  location: class LifecycleHelper
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\LifecycleHelper.java:46: error: cannot find symbol
  public <T extends View & LifecycleObserver> void register(T view) {
                           ^
  symbol:   class LifecycleObserver
  location: class LifecycleHelper
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\LifecycleHelper.java:55: error: cannot find symbol
  public <T extends View & LifecycleObserver> void unregister(T view) {
                           ^
  symbol:   class LifecycleObserver
  location: class LifecycleHelper
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\Screen.java:3: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\Screen.java:4: error: package androidx.fragment.app does not exist
import androidx.fragment.app.Fragment;
                            ^
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\Screen.java:41: error: cannot find symbol
  private final Fragment mFragment;
                ^
  symbol:   class Fragment
  location: class Screen
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenContainer.java:3: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenContainer.java:4: error: package androidx.fragment.app does not exist
import androidx.fragment.app.Fragment;
                            ^
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenContainer.java:5: error: package androidx.fragment.app does not exist
import androidx.fragment.app.FragmentActivity;
                            ^
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenContainer.java:6: error: package androidx.fragment.app does not exist
import androidx.fragment.app.FragmentTransaction;
                            ^
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\Screen.java:96: error: cannot find symbol
  protected Fragment getFragment() {
            ^
  symbol:   class Fragment
  location: class Screen
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenContainer.java:27: error: cannot find symbol
  private @Nullable FragmentTransaction mCurrentTransaction;
                    ^
  symbol:   class FragmentTransaction
  location: class ScreenContainer
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenContainer.java:82: error: cannot find symbol
  private FragmentActivity findRootFragmentActivity() {
          ^
  symbol:   class FragmentActivity
  location: class ScreenContainer
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenContainer.java:108: error: cannot find symbol
  private FragmentTransaction getOrCreateTransaction() {
          ^
  symbol:   class FragmentTransaction
  location: class ScreenContainer
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\Screen.java:19: error: cannot find symbol
  public static class ScreenFragment extends Fragment {
                                             ^
  symbol:   class Fragment
  location: class Screen
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\Screen.java:42: error: cannot find symbol
  private @Nullable ScreenContainer mContainer;
           ^
  symbol:   class Nullable
  location: class Screen
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\Screen.java:80: error: cannot find symbol
  public void setLayerType(int layerType, @Nullable Paint paint) {
                                           ^
  symbol:   class Nullable
  location: class Screen
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\Screen.java:88: error: cannot find symbol
  protected void setContainer(@Nullable ScreenContainer mContainer) {
                               ^
  symbol:   class Nullable
  location: class Screen
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\Screen.java:92: error: cannot find symbol
  protected @Nullable ScreenContainer getContainer() {
             ^
  symbol:   class Nullable
  location: class Screen
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenContainer.java:27: error: cannot find symbol
  private @Nullable FragmentTransaction mCurrentTransaction;
           ^
  symbol:   class Nullable
  location: class ScreenContainer
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\Screen.java:35: error: cannot find symbol
                             @Nullable ViewGroup container,
                              ^
  symbol:   class Nullable
  location: class ScreenFragment
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\Screen.java:36: error: cannot find symbol
                             @Nullable Bundle savedInstanceState) {
                              ^
  symbol:   class Nullable
  location: class ScreenFragment
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\LifecycleHelper.java:38: error: cannot find symbol
    Fragment parent = findNearestScreenFragmentAncestor(view);
    ^
  symbol:   class Fragment
  location: class LifecycleHelper
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\LifecycleHelper.java:39: error: cannot find symbol
    if (parent != null && view instanceof LifecycleObserver) {
                                          ^
  symbol:   class LifecycleObserver
  location: class LifecycleHelper
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\LifecycleHelper.java:40: error: cannot find symbol
      Lifecycle lifecycle = parent.getLifecycle();
      ^
  symbol:   class Lifecycle
  location: class LifecycleHelper
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\LifecycleHelper.java:41: error: cannot find symbol
      lifecycle.addObserver((LifecycleObserver) view);
                             ^
  symbol:   class LifecycleObserver
  location: class LifecycleHelper
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\LifecycleHelper.java:56: error: cannot find symbol
    Lifecycle lifecycle = mViewToLifecycleMap.get(view);
    ^
  symbol:   class Lifecycle
  location: class LifecycleHelper
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\Screen.java:33: error: method does not override or implement a method from a supertype
    @Override
    ^
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenContainer.java:98: error: cannot find symbol
    while (!(context instanceof FragmentActivity) && context instanceof ContextWrapper) {
                                ^
  symbol:   class FragmentActivity
  location: class ScreenContainer
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenContainer.java:101: error: cannot find symbol
    if (!(context instanceof FragmentActivity)) {
                             ^
  symbol:   class FragmentActivity
  location: class ScreenContainer
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenContainer.java:105: error: cannot find symbol
    return (FragmentActivity) context;
            ^
  symbol:   class FragmentActivity
  location: class ScreenContainer
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenContainer.java:129: error: cannot find symbol
    FragmentTransaction transaction = getOrCreateTransaction();
    ^
  symbol:   class FragmentTransaction
  location: class ScreenContainer
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenContainer.java:130: error: cannot find symbol
    Fragment fragment = screen.getFragment();
    ^
  symbol:   class Fragment
  location: class ScreenContainer
37 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-screens: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 8s
183 actionable tasks: 2 executed, 181 up-to-date
error 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
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.

After several lookups on the Internet, I found the solution. The problem was with the react-native-screens version. Just downgraded it to 1.0.0-alpha.22 from 1.0.0-alpha.23

After successfully fixing it, I encountered this error during build.


C:\Users\irizv\OneDrive\Desktop\zulip-mobile>yarn install
yarn install v1.19.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Saved lockfile.
Done in 25.12s.

C:\Users\irizv\OneDrive\Desktop\zulip-mobile>react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...

> Configure project :@remobile_react-native-toast
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Configure project :react-native-device-info
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Configure project :react-native-image-picker
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Configure project :react-native-notifications
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Configure project :react-native-orientation
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Configure project :react-native-photo-view
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
<=======------> 58% CONFIGURING [7s]
> :react-native-screens
<=======------> 58% CONFIGURING [8s]
> :react-native-screens > Compiling C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-screens\andr


> Configure project :react-native-screens
WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getJavaCompile(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.

> Configure project :react-native-sentry
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Configure project :react-native-text-input-reset
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
<===========--> 88% CONFIGURING [9s]

> Configure project :react-native-webview
:react-native-webview:reactNativeAndroidRoot C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native\android

> Task :@react-native-community_netinfo:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :react-native-device-info:compileDebugJavaWithJavac
Note: C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-device-info\android\src\main\java\com\learnium\RNDeviceInfo\RNDeviceModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :react-native-image-picker:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :react-native-notifications:compileDebugJavaWithJavac
Note: C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-notifications\android\src\main\java\com\wix\reactnativenotifications\core\notification\PushNotification.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :react-native-sentry:compileDebugJavaWithJavac
Note: C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-sentry\android\src\main\java\io\sentry\RNSentryModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :react-native-photo-view:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :react-native-sound:compileDebugJavaWithJavac
Note: C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-sound\android\src\main\java\com\zmxv\RNSound\RNSoundModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
<========-----> 66% EXECUTING [32s]
> IDLE
<========-----> 66% EXECUTING [33s]
> :react-native-text-input-reset:javaPreCompileDebug
<========-----> 66% EXECUTING [34s]ileDebug
> :react-native-webview:compileDebugKotlin
> :react-native-vector-icons:javaPreCompileDebug
<========-----> 66% EXECUTING [35s]

<========-----> 66% EXECUTING [36s]

<========-----> 67% EXECUTING [37s]

<========-----> 67% EXECUTING [38s]

> Task :react-native-webview:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\irizv\OneDrive\Desktop\zulip-mobile\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
<========-----> 68% EXECUTING [38s]
<==========---> 81% EXECUTING [43s]
<==========---> 82% EXECUTING [43s]
<==========---> 83% EXECUTING [44s]
> Transforming artifact full.jar (project :react-native-device-info) with DexingWithClasspathTransform > DexingWithClas
<==========---> 83% EXECUTING [45s]timeDebug
<===========--> 85% EXECUTING [46s]
> Transforming artifact full.jar (project :react-native-photo-view) with DexingWithClasspathTransform > DexingWithClass
> Transforming artifact full.jar (project :react-native-sentry) with DexingWithClasspathTransform > DexingWithClasspath
> :react-native-webview:bundleLibRuntimeDebug
<===========--> 85% EXECUTING [47s]
> :rn-fetch-blob:compileDebugJavaWithJavac
> :react-native-document-picker:bundleLibRuntimeDebug

> Task :rn-fetch-blob:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
<===========--> 85% EXECUTING [48s]
> IDLE
<===========--> 86% EXECUTING [48s]
<===========--> 86% EXECUTING [49s]ntimeDebug
> :rn-fetch-blob:bundleLibRuntimeDebug
<===========--> 86% EXECUTING [50s]arDebug
> IDLE
<===========--> 86% EXECUTING [51s] files of :app:debugCompileClasspath > kotlin-stdlib-jdk7-1.3.50.jar > DexingWithCla
> :app:compileDebugKotlin > Resolve files of :app:debugCompileClasspath > kotlin-android-extensions-runtime-1.3.50.jar
> IDLE
<===========--> 86% EXECUTING [52s] files of :app:debugCompileClasspath > kotlin-stdlib-jdk7-1.3.50.jar > 3 KB/3 KB dow
> IDLE
<===========--> 86% EXECUTING [53s]

<===========--> 86% EXECUTING [55s]
<===========--> 86% EXECUTING [56s]

<===========--> 86% EXECUTING [57s]

<===========--> 86% EXECUTING [58s]
<===========--> 86% EXECUTING [59s]

<===========--> 86% EXECUTING [1m 0s]


<===========--> 86% EXECUTING [1m 1s]
<===========--> 86% EXECUTING [1m 2s]

> Task :app:compileDebugKotlin
w: C:\Users\irizv\OneDrive\Desktop\zulip-mobile\android\app\src\main\java\com\zulipmobile\notifications\FCMPushNotifications.kt:
 (87, 37): Parameter 'context' is never used
w: C:\Users\irizv\OneDrive\Desktop\zulip-mobile\android\app\src\main\java\com\zulipmobile\notifications\FCMPushNotifications.kt: (98, 22): 'constructor Builder(Context!)' is deprecated. Deprecated in Java

w: C:\Users\irizv\OneDrive\Desktop\zulip-mobile\android\app\src\main\java\com\zulipmobile\notifications\FCMPushNotifications.kt: (139, 39): 'constructor InboxStyle(Notification.Builder!)' is deprecated. Deprecated in Java
w: C:\Users\irizv\OneDrive\Desktop\zulip-mobile\android\app\src\main\java\com\zulipmobile\notifications\FCMPushNotifications.kt:
 (155, 13): 'setVibrate(LongArray!): Notification.Builder!' is deprecated. Deprecated in Java
w: C:\Users\irizv\OneDrive\Desktop\zulip-mobile\android\app\src\main\java\com\zulipmobile\notifications\FCMPushNotifications.kt: (157, 13): 'setDefaults(Int): Notification.Builder!' is deprecated. Deprecated in Java

w: C:\Users\irizv\OneDrive\Desktop\zulip-mobile\android\app\src\main\java\com\zulipmobile\notifications\FCMPushNotifications.kt: (163, 35): 'constructor Action(Int, CharSequence!, PendingIntent!)' is deprecated. Deprecated in Java
w: C:\Users\irizv\OneDrive\Desktop\zulip-mobile\android\app\src\main\java\com\zulipmobile\notifications\FCMPushNotifications.kt:
 (171, 17): 'setSound(Uri!, AudioAttributes!): Notification.Builder!' is deprecated. Deprecated in Java
w: C:\Users\irizv\OneDrive\Desktop\zulip-mobile\android\app\src\main\java\com\zulipmobile\notifications\FCMPushNotifications.kt: (173, 17): 'setSound(Uri!): Notification.Builder!' is deprecated. Deprecated in Java

> Task :app:compileDebugJavaWithJavac
C:\Users\irizv\OneDrive\Desktop\zulip-mobile\android\app\src\main\java\com\zulipmobile\MainApplication.java:45: error: constructor RNNotificationsPackage in class RNNotificationsPackage cannot be applied to given types;
            new RNNotificationsPackage(),
            ^
  required: Application
  found: no arguments
  reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

> Task :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. 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 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1m 8s
251 actionable tasks: 239 executed, 12 up-to-date
error 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
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.

then looked up more and found that it is something related to react-native-notifications. This issue helped me in solving it wix/react-native-notifications#236

In the MainApplication.java

replace: new RNNotificationsPackage(),
with: new RNNotificationsPackage(MainApplication.this),

After doing the above changes, I ran the build and finally it was successful.

By the way, you shouldn't be doing react-native link

@gnprice
Copy link
Member

gnprice commented Oct 28, 2019

From debugging in chat, we learned that the cause was that you'd run the command react-native link, which edits the source code.

In particular, it apparently adds the line new RNNotificationsPackage(),, which as you found is not well-typed.

The solution is to not run that command, which doesn't do anything useful for us 🙂

Might be useful to have an entry in the setup troubleshooting section to help recognize this error if someone else runs into it in the future.

@gnprice gnprice closed this as completed Oct 28, 2019
@gnprice gnprice changed the title compileDebugJavaWithJavac FAILED build fails if run react-native link Oct 28, 2019
@realabbas
Copy link
Author

realabbas commented Oct 28, 2019

Yeah, now I get it, running react-native link creates a lot of unnecessary mess 😁

@gnprice
Copy link
Member

gnprice commented Oct 28, 2019

Might be useful to have an entry in the setup troubleshooting section to help recognize this error if someone else runs into it in the future.

Done, in 434d8c4:
https://github.com/zulip/zulip-mobile/blob/master/docs/howto/build-run.md#build-failure-in-react-native-screens-or-at-new-rnnotificationspackage

@gnprice
Copy link
Member

gnprice commented Oct 28, 2019

The way I put it about react-native link in general is:

Some React Native projects reportedly say in their build instructions
to run this command before building. This is a bad practice: the
command edits the project's source files in heuristic ways, and so it
should always be a development step -- with the results committed to
the project's version-control repo -- and not a build step. We don't
use it as a build step.

@realabbas
Copy link
Author

Yeah, and it will be very useful instruction that you added in the build-run.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants