Skip to content

Commit 4f18b11

Browse files
committed
fix(android): build
1 parent b41f048 commit 4f18b11

33 files changed

+16179
-11636
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
lib
2+
# Yarn
3+
.yarn/*
4+
!.yarn/patches
5+
!.yarn/plugins
6+
!.yarn/releases
7+
!.yarn/sdks
8+
!.yarn/versions
19
# OSX
210
#
311
.DS_Store

.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

+541
Large diffs are not rendered by default.

.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

+28
Large diffs are not rendered by default.

.yarn/releases/yarn-3.6.1.cjs

+874
Large diffs are not rendered by default.

.yarnrc

-3
This file was deleted.

.yarnrc.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
nodeLinker: node-modules
2+
nmHoistingLimits: workspaces
3+
4+
plugins:
5+
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
6+
spec: "@yarnpkg/plugin-interactive-tools"
7+
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
8+
spec: "@yarnpkg/plugin-workspace-tools"
9+
10+
yarnPath: .yarn/releases/yarn-3.6.1.cjs

babel.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
presets: ['module:metro-react-native-babel-preset'],
2+
presets: ['module:@react-native/babel-preset'],
33
};

example/android/app/build.gradle

+6-57
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
apply plugin: "com.android.application"
2+
apply plugin: "org.jetbrains.kotlin.android"
23
apply plugin: "com.facebook.react"
34

4-
import com.android.build.OutputFile
5-
65
/**
76
* This is the configuration block to customize your React Native Android app.
87
* By default you don't need to apply any configuration, just uncomment the lines you need.
@@ -13,8 +12,8 @@ react {
1312
// root = file("../")
1413
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
1514
// reactNativeDir = file("../node_modules/react-native")
16-
// The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
17-
// codegenDir = file("../node_modules/react-native-codegen")
15+
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
16+
// codegenDir = file("../node_modules/@react-native/codegen")
1817
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
1918
// cliFile = file("../node_modules/react-native/cli.js")
2019

@@ -52,14 +51,6 @@ react {
5251
// hermesFlags = ["-O", "-output-source-map"]
5352
}
5453

55-
/**
56-
* Set this to true to create four separate APKs instead of one,
57-
* one for each native architecture. This is useful if you don't
58-
* use App Bundles (https://developer.android.com/guide/app-bundle/)
59-
* and want to have separate APKs to upload to the Play Store.
60-
*/
61-
def enableSeparateBuildPerCPUArchitecture = false
62-
6354
/**
6455
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
6556
*/
@@ -78,20 +69,10 @@ def enableProguardInReleaseBuilds = false
7869
*/
7970
def jscFlavor = 'org.webkit:android-jsc:+'
8071

81-
/**
82-
* Private function to get the list of Native Architectures you want to build.
83-
* This reads the value from reactNativeArchitectures in your gradle.properties
84-
* file and works together with the --active-arch-only flag of react-native run-android.
85-
*/
86-
def reactNativeArchitectures() {
87-
def value = project.getProperties().get("reactNativeArchitectures")
88-
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
89-
}
90-
9172
android {
9273
ndkVersion rootProject.ext.ndkVersion
93-
94-
compileSdkVersion rootProject.ext.compileSdkVersion
74+
buildToolsVersion rootProject.ext.buildToolsVersion
75+
compileSdk rootProject.ext.compileSdkVersion
9576

9677
namespace "com.jsibridge2example"
9778
defaultConfig {
@@ -101,15 +82,6 @@ android {
10182
versionCode 1
10283
versionName "1.0"
10384
}
104-
105-
splits {
106-
abi {
107-
reset()
108-
enable enableSeparateBuildPerCPUArchitecture
109-
universalApk false // If true, also generate a universal APK
110-
include (*reactNativeArchitectures())
111-
}
112-
}
11385
signingConfigs {
11486
debug {
11587
storeFile file('debug.keystore')
@@ -130,36 +102,13 @@ android {
130102
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
131103
}
132104
}
133-
134-
// applicationVariants are e.g. debug, release
135-
applicationVariants.all { variant ->
136-
variant.outputs.each { output ->
137-
// For each separate APK per architecture, set a unique version code as described here:
138-
// https://developer.android.com/studio/build/configure-apk-splits.html
139-
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
140-
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
141-
def abi = output.getFilter(OutputFile.ABI)
142-
if (abi != null) { // null for the universal-debug, universal-release variants
143-
output.versionCodeOverride =
144-
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
145-
}
146-
147-
}
148-
}
149105
}
150106

151107
dependencies {
152108
// The version of react-native is set by the React Native Gradle Plugin
153109
implementation("com.facebook.react:react-android")
110+
implementation("com.facebook.react:flipper-integration")
154111

155-
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
156-
157-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
158-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
159-
exclude group:'com.squareup.okhttp3', module:'okhttp'
160-
}
161-
162-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
163112
if (hermesEnabled.toBoolean()) {
164113
implementation("com.facebook.react:hermes-android")
165114
} else {

example/android/app/src/debug/AndroidManifest.xml

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools">
44

5-
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
6-
75
<application
86
android:usesCleartextTraffic="true"
97
tools:targetApi="28"
10-
tools:ignore="GoogleAppIndexingWarning">
11-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
12-
</application>
8+
tools:ignore="GoogleAppIndexingWarning"/>
139
</manifest>

example/android/app/src/debug/java/com/jsibridge2example/ReactNativeFlipper.java

-75
This file was deleted.

example/android/app/src/main/java/com/jsibridge2example/MainActivity.java

-48
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.jsibridge2example
2+
3+
import android.os.Bundle;
4+
5+
import com.facebook.react.ReactActivity
6+
import com.facebook.react.ReactActivityDelegate
7+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
8+
import com.facebook.react.defaults.DefaultReactActivityDelegate
9+
import com.reactnativejsibridge.JsiBridge
10+
11+
12+
class MainActivity : ReactActivity() {
13+
14+
/**
15+
* Returns the name of the main component registered from JavaScript. This is used to schedule
16+
* rendering of the component.
17+
*/
18+
override fun getMainComponentName(): String = "JsiBridge2Example"
19+
20+
/**
21+
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
22+
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
23+
*/
24+
override fun createReactActivityDelegate(): ReactActivityDelegate =
25+
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
26+
27+
override fun onCreate(savedInstanceState: Bundle?) {
28+
super.onCreate(savedInstanceState)
29+
30+
JsiBridge.off("jsData")
31+
JsiBridge.on("jsData", { data ->
32+
JsiBridge.emit("onData", data);
33+
})
34+
}
35+
}

example/android/app/src/main/java/com/jsibridge2example/MainApplication.java

-62
This file was deleted.

0 commit comments

Comments
 (0)