Android build working

This commit is contained in:
diegolmello 2019-08-01 16:46:42 -03:00
parent c6c5e12543
commit fb5eca327a
9 changed files with 106 additions and 99 deletions

View File

@ -201,26 +201,38 @@ android {
}
dependencies {
// addUnimodulesDependencies()
// implementation "org.webkit:android-jsc:r241213"
// implementation project(':react-native-action-sheet')
// implementation(project(":react-native-device-info"), {
// exclude group: "com.google.android.gms"
// })
// implementation project(":reactnativekeyboardinput")
// implementation project(':realm')
// implementation project(':reactnativenotifications')
// implementation fileTree(dir: "libs", include: ["*.jar"])
// implementation "com.android.support:appcompat-v7:${ rootProject.ext.supportLibVersion }"
// implementation "com.android.support:support-v4:${ rootProject.ext.supportLibVersion }"
// implementation "com.android.support:customtabs:${ rootProject.ext.supportLibVersion }"
// implementation "com.android.support:design:${ rootProject.ext.supportLibVersion }"
// implementation "com.facebook.react:react-native:+" // From node_modules
// implementation 'com.facebook.fresco:fresco:1.10.0'
// implementation 'com.facebook.fresco:animated-gif:1.10.0'
// implementation 'com.facebook.fresco:animated-webp:1.10.0'
// implementation 'com.facebook.fresco:webpsupport:1.10.0'
// implementation "com.google.android.gms:play-services-base:16.1.0"
// implementation "com.google.firebase:firebase-messaging:18.0.0"
// implementation "com.google.firebase:firebase-core:16.0.9"
// implementation "com.google.firebase:firebase-perf:16.2.5"
// implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
// transitive = true
// }
addUnimodulesDependencies()
implementation "org.webkit:android-jsc:r241213"
implementation project(':react-native-action-sheet')
implementation(project(":react-native-device-info"), {
exclude group: "com.google.android.gms"
})
implementation project(":reactnativekeyboardinput")
implementation project(':realm')
implementation project(':reactnativenotifications')
implementation project(':react-native-firebase')
implementation project(":reactnativekeyboardinput")
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${ rootProject.ext.supportLibVersion }"
implementation "com.android.support:support-v4:${ rootProject.ext.supportLibVersion }"
implementation "com.android.support:customtabs:${ rootProject.ext.supportLibVersion }"
implementation "com.android.support:design:${ rootProject.ext.supportLibVersion }"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.facebook.fresco:fresco:1.10.0'
implementation 'com.facebook.fresco:animated-gif:1.10.0'
implementation 'com.facebook.fresco:animated-webp:1.10.0'
implementation 'com.facebook.fresco:webpsupport:1.10.0'
implementation "com.google.android.gms:play-services-base:16.1.0"
implementation "com.google.firebase:firebase-messaging:18.0.0"
implementation "com.google.firebase:firebase-core:16.0.9"
implementation "com.google.firebase:firebase-perf:16.2.5"

View File

@ -11,11 +11,11 @@ import android.content.res.Configuration;
public class MainActivity extends ReactFragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this);
super.onCreate(null);
}
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// SplashScreen.show(this);
// super.onCreate(null);
// }
/**
* Returns the name of the main component registered from JavaScript.
@ -36,12 +36,12 @@ public class MainActivity extends ReactFragmentActivity {
};
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Intent intent = new Intent("onConfigurationChanged");
intent.putExtra("newConfig", newConfig);
this.sendBroadcast(intent);
}
// @Override
// public void onConfigurationChanged(Configuration newConfig) {
// super.onConfigurationChanged(newConfig);
// Intent intent = new Intent("onConfigurationChanged");
// intent.putExtra("newConfig", newConfig);
// this.sendBroadcast(intent);
// }
}

View File

@ -6,39 +6,29 @@ import android.util.Log;
import com.facebook.react.PackageList;
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.ReactApplication;
import io.invertase.firebase.fabric.crashlytics.RNFirebaseCrashlyticsPackage;
import io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage;
import io.invertase.firebase.perf.RNFirebasePerformancePackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.wix.reactnativekeyboardinput.KeyboardInputPackage;
import com.wix.reactnativenotifications.RNNotificationsPackage;
import com.wix.reactnativenotifications.core.AppLaunchHelper;
import com.wix.reactnativenotifications.core.AppLifecycleFacade;
import com.wix.reactnativenotifications.core.JsIOHelper;
import com.wix.reactnativenotifications.core.notification.INotificationsApplication;
import com.wix.reactnativenotifications.core.notification.IPushNotification;
import com.actionsheet.ActionSheetPackage;
import io.realm.react.RealmReactPackage;
import chat.rocket.reactnative.generated.BasePackageList;
import org.unimodules.adapters.react.ModuleRegistryAdapter;
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
import org.unimodules.core.interfaces.SingletonModule;
import android.content.Context;
import android.os.Bundle;
import com.wix.reactnativenotifications.RNNotificationsPackage;
import com.wix.reactnativekeyboardinput.KeyboardInputPackage;
import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.fabric.crashlytics.RNFirebaseCrashlyticsPackage;
import io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage;
import io.invertase.firebase.perf.RNFirebasePerformancePackage;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication, INotificationsApplication {
public class MainApplication extends Application implements ReactApplication {
private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(new BasePackageList().getPackageList(), Arrays.<SingletonModule>asList());
@ -52,8 +42,11 @@ public class MainApplication extends Application implements ReactApplication, IN
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new RNFirebasePackage());
packages.add(new RNFirebaseCrashlyticsPackage());
packages.add(new RNFirebaseAnalyticsPackage());
packages.add(new RNFirebasePerformancePackage());
packages.add(new KeyboardInputPackage(MainApplication.this));
packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
return packages;
}
@ -74,15 +67,4 @@ public class MainApplication extends Application implements ReactApplication, IN
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
@Override
public IPushNotification getPushNotification(Context context, Bundle bundle, AppLifecycleFacade defaultFacade, AppLaunchHelper defaultAppLaunchHelper) {
return new CustomPushNotification(
context,
bundle,
defaultFacade,
defaultAppLaunchHelper,
new JsIOHelper()
);
}
}

View File

@ -17,5 +17,7 @@
# org.gradle.parallel=true
android.enableAapt2=false # commenting this makes notifications to stop working
android.useDeprecatedNdk=true
# android.useDeprecatedNdk=true
android.useAndroidX=true
android.enableJetifier=true
VERSIONCODE=999999999

View File

@ -2,5 +2,11 @@ apply from: '../node_modules/react-native-unimodules/gradle.groovy'
includeUnimodulesProjects()
rootProject.name = 'EmptyRN'
include ':reactnativenotifications'
project(':reactnativenotifications').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-notifications/android')
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
include ':reactnativekeyboardinput'
project(':reactnativekeyboardinput').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-keyboard-input/lib/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'

View File

@ -24,8 +24,9 @@ class PushNotification {
configure(params) {
this.onRegister = params.onRegister;
this.onNotification = params.onNotification;
NotificationsAndroid.refreshToken();
return PendingNotifications.getInitialNotification();
// NotificationsAndroid.refreshToken();
// return PendingNotifications.getInitialNotification();
return Promise.resolve()
}
}

View File

@ -1,42 +1,22 @@
diff --git a/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/CustomKeyboardRootView.java b/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/CustomKeyboardRootView.java
index 69ef9f3..10729c8 100644
--- a/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/CustomKeyboardRootView.java
+++ b/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/CustomKeyboardRootView.java
@@ -1,7 +1,7 @@
package com.wix.reactnativekeyboardinput;
diff --git a/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/CustomKeyboardRootViewShadow.java b/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/CustomKeyboardRootViewShadow.java
index 3c8d37e..2fb804d 100644
--- a/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/CustomKeyboardRootViewShadow.java
+++ b/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/CustomKeyboardRootViewShadow.java
@@ -13,10 +13,10 @@ public class CustomKeyboardRootViewShadow extends LayoutShadowNode {
mLayout.setShadowNode(this);
}
import android.content.Context;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import android.view.View;
import android.widget.FrameLayout;
- @Override
- public void onBeforeLayout() {
- mLayout.setShadowNode(this);
- }
+ // @Override
+ // public void onBeforeLayout() {
+ // mLayout.setShadowNode(this);
+ // }
diff --git a/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/ReactSoftKeyboardMonitor.java b/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/ReactSoftKeyboardMonitor.java
index eecb682..f4d3712 100644
--- a/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/ReactSoftKeyboardMonitor.java
+++ b/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/ReactSoftKeyboardMonitor.java
@@ -1,7 +1,7 @@
package com.wix.reactnativekeyboardinput;
import android.graphics.Rect;
-import android.support.annotation.Nullable;
+import androidx.annotation.Nullable;
import android.view.ViewTreeObserver;
import com.facebook.react.ReactRootView;
diff --git a/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/utils/ViewUtils.java b/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/utils/ViewUtils.java
index 5eda46a..39c30a7 100644
--- a/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/utils/ViewUtils.java
+++ b/node_modules/react-native-keyboard-input/lib/android/src/main/java/com/wix/reactnativekeyboardinput/utils/ViewUtils.java
@@ -1,7 +1,7 @@
package com.wix.reactnativekeyboardinput.utils;
import android.app.Activity;
-import android.support.annotation.Nullable;
+import androidx.annotation.Nullable;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
public void setHeight(int heightPx) {
setStyleHeight(heightPx);
diff --git a/node_modules/react-native-keyboard-input/react-native-keyboard-input.podspec b/node_modules/react-native-keyboard-input/react-native-keyboard-input.podspec
new file mode 100644
index 0000000..1d08ca1

24
react-native.config.js Normal file
View File

@ -0,0 +1,24 @@
module.exports = {
dependencies: {
'realm': {
platforms: {
ios: null,
},
},
'react-native-notifications': {
platforms: {
android: null
}
},
'react-native-firebase': {
platforms: {
android: null
}
},
'react-native-keyboard-input': {
platforms: {
android: null
}
}
}
};