Skip to content

Commit 56dd3d0

Browse files
committed
🐞 fix(android): fix build issue
1 parent f04c0eb commit 56dd3d0

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

README.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ If this project has helped you out, please support us with a star 🌟
1919
| RNSimpleOpenvpn | React Native |
2020
| --------------- | ------------- |
2121
| `1.0.0 ~ 1.2.0` | `0.56 ~ 0.66` |
22-
| `>= 2.0.0` | `>= 0.63` |
22+
| `2.0.0 ~ 2.1.1` | `0.63 ~ 0.71` |
23+
| `>= 2.1.2` | `>= 0.72` |
2324

2425
See [CHANGELOG](CHANGELOG.md) for details
2526

@@ -62,6 +63,19 @@ apply from: file("../node_modules/@react-native-community/cli-platform-android/n
6263
include ':app'
6364
```
6465

66+
If your React Native version is 0.74 or higher, add the following to `android/app/build.gradle` :
67+
68+
```diff
69+
android {
70+
// ...
71+
+ packaging {
72+
+ jniLibs {
73+
+ useLegacyPackaging = true
74+
+ }
75+
+ }
76+
}
77+
```
78+
6579
#### Import jniLibs
6680

6781
Due to file size limitations, jniLibs are too big to be published on npm. Use the assets on [GitHub Releases](https://github.com/ccnnde/react-native-simple-openvpn/releases/tag/v2.0.0) instead

README.zh-CN.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ react-native-simple-openvpn 提供了与 OpenVPN 交互的接口
1919
| RNSimpleOpenvpn | React Native |
2020
| --------------- | ------------- |
2121
| `1.0.0 ~ 1.2.0` | `0.56 ~ 0.66` |
22-
| `>= 2.0.0` | `>= 0.63` |
22+
| `2.0.0 ~ 2.1.1` | `0.63 ~ 0.71` |
23+
| `>= 2.1.2` | `>= 0.72` |
2324

2425
详细信息请参考[更改日志](CHANGELOG.md)
2526

@@ -62,6 +63,19 @@ apply from: file("../node_modules/@react-native-community/cli-platform-android/n
6263
include ':app'
6364
```
6465

66+
如果你的 React Native 版本大于等于 0.74,在项目的 `android/app/build.gradle` 中添加以下代码:
67+
68+
```diff
69+
android {
70+
// ...
71+
+ packaging {
72+
+ jniLibs {
73+
+ useLegacyPackaging = true
74+
+ }
75+
+ }
76+
}
77+
```
78+
6579
#### 导入 jniLibs
6680

6781
由于存在文件大小的限制,jniLibs 无法随模块一起发布到 npm 上。故使用 [GitHub Releases](https://github.com/ccnnde/react-native-simple-openvpn/releases/tag/v2.0.0) 中的 assets 来代替

android/src/main/java/com/norcod/rnovpn/RNSimpleOpenvpnModule.java

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import com.facebook.react.bridge.WritableMap;
4646
import com.facebook.react.modules.core.DeviceEventManagerModule;
4747

48+
import de.blinkt.openvpn.R;
4849
import de.blinkt.openvpn.VpnProfile;
4950
import de.blinkt.openvpn.core.ConfigParser;
5051
import de.blinkt.openvpn.core.ConnectionStatus;

vpnLib/build.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,14 @@ buildscript {
3535
mavenCentral()
3636
}
3737
dependencies {
38-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"
38+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0"
3939
}
4040
}
4141

4242
android {
43+
buildFeatures {
44+
aidl = true
45+
}
4346
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
4447
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
4548
defaultConfig {

0 commit comments

Comments
 (0)