Skip to content

react-native-navigation:compileReleaseJavaWithJavac - is not incremental #2587

@flavio-dev

Description

@flavio-dev

Issue Description

when running yarn android I have this error:
react-native-navigation:compileReleaseJavaWithJavac - is not incremental

Steps to Reproduce / Code Snippets / Screenshots

Installed react native navigation and followed the steps. Works on iOS. Doesn't on android. Here are my files:

MainActivity.java

package com.chatterytest;

// import com.facebook.react.ReactActivity;
import com.reactnativenavigation.controllers.SplashActivity;

public class MainActivity extends SplashActivity {

    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    // @Override
    // protected String getMainComponentName() {
    //     return "chatterytest";
    // }
}

MainApplication.java

package com.chatterytest;

import android.app.Application;

import com.facebook.react.ReactApplication;
import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;

import com.reactnativenavigation.NavigationApplication;

import java.util.Arrays;
import java.util.List;

// public class MainApplication extends Application implements ReactApplication {
public class MainApplication extends NavigationApplication {

  // private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    // @Override
    // public boolean getUseDeveloperSupport() {
    //   return BuildConfig.DEBUG;
    // }
    //
    // @Override
    // protected List<ReactPackage> getPackages() {
    //   return Arrays.<ReactPackage>asList(
    //       new MainReactPackage(),
    //         new VectorIconsPackage()
    //   );
    // }
    //
    // @Override
    // protected String getJSMainModuleName() {
    //   return "index";
    // }

    @Override
     public boolean isDebug() {
         // Make sure you are using BuildConfig from your own application
         return BuildConfig.DEBUG;
     }

     public List<ReactPackage> getPackages() {
         // Add additional packages you require here
         // No need to add RnnPackage and MainReactPackage
         return Arrays.<ReactPackage>asList(
             // eg. new VectorIconsPackage()
             new VectorIconsPackage()
         );
     }

     @Override
     public List<ReactPackage> createAdditionalReactPackages() {
         return getPackages();
     }

     @Override
     public String getJSMainModuleName() {
         return "index";
     }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
  }
}

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.chatterytest"
    android:versionCode="1"
    android:versionName="1.0">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="22" />

    <application
      android:name=".MainApplication"
      android:allowBackup="true"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

build.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.chatterytest"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':react-native-vector-icons')
    compile project(':react-native-navigation')
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

Settings.gradle:

include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')

include ':react-native-navigation'
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/android/app/')

include ':app'

and the full error stack:

/node_modules/react-native-navigation/android/app/src/main/java/com/reactnativenavigation/react/JsDevReloadListenerReplacer.java:5: error: cannot find symbol
import com.facebook.react.devsupport.ReactInstanceDevCommandsHandler;
                                    ^
  symbol:   class ReactInstanceDevCommandsHandler
  location: package com.facebook.react.devsupport

/node_modules/react-native-navigation/android/app/src/main/java/com/reactnativenavigation/react/JsDevReloadListenerReplacer.java:41: error: cannot find symbol
    private static class DevCommandsHandlerProxy implements ReactInstanceDevCommandsHandler {
                                                            ^
  symbol:   class ReactInstanceDevCommandsHandler
  location: class JsDevReloadListenerReplacer

/node_modules/react-native-navigation/android/app/src/main/java/com/reactnativenavigation/react/JsDevReloadListenerReplacer.java:33: error: cannot find symbol
    private ReactInstanceDevCommandsHandler getOriginalHandler() {
            ^
  symbol:   class ReactInstanceDevCommandsHandler
  location: class JsDevReloadListenerReplacer

/node_modules/react-native-navigation/android/app/src/main/java/com/reactnativenavigation/react/JsDevReloadListenerReplacer.java:42: error: cannot find symbol
        private ReactInstanceDevCommandsHandler originalReactHandler;
                ^
  symbol:   class ReactInstanceDevCommandsHandler
  location: class DevCommandsHandlerProxy

and it carries on...

Environment

  • React Native Navigation version: 1.1.351

  • React Native version:
    react-native-cli: 2.0.1
    react-native: 0.52.0

  • Platform(s): Android

  • Device info (Simulator/Device? OS version? Debug/Release?): Simulator, running android 6.0 on compileSdkVersion 23

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions