Skip to content

Commit 425f868

Browse files
authored
Merge pull request #644 from OneSignal/fix/proguardAndroidlib
[Fix] Android minify builds
2 parents 432063f + 32d4a01 commit 425f868

File tree

67 files changed

+144
-865
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+144
-865
lines changed

MIGRATION_GUIDE_v3_to_v5.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ OneSignal uses a built-in **alias label** called `external_id` which supports ex
3131
Follow one of the following sections based on your previous install method of the OneSignal SDK.
3232

3333
### Unity Package Manager
34-
1. If you have them, delete the directory at `Assets/OneSignal` and the xml file at `Assets/Plugins/Android/OneSignalConfig.plugin/AndroidManifest.xml`
34+
1. If you have it, delete the directory at `Assets/OneSignal`
3535
2. In Unity, open **Window > Package Manager**
3636
3. From the **Package Manager** window, select **Packages:** in the top left and click on **In Project**
3737
4. Select the OneSignal Unity SDK(s) and press the **Upgrade to 5.x.x** button (make sure to update both Android and iOS packages)
3838
5. Follow the [API Reference](#api-reference) guide below to fix any compilation errors with the new namespaces and updated method calls
3939
6. Check the menu at **Window > OneSignal SDK Setup** to see if there are any remaining steps to run
4040

4141
### Unity Asset Store
42-
1. Delete the directory at `Assets/OneSignal` and the xml file at `Assets/Plugins/Android/OneSignalConfig.plugin/AndroidManifest.xml`
42+
1. Delete the directory at `Assets/OneSignal`
4343
2. In Unity, open **Window > Package Manager**
4444
3. From the **Package Manager** window, select **Packages:** in the top left and click on **My Assets**
4545
4. Select the **OneSignal SDK** from the list and press the **Update** button.
@@ -50,13 +50,13 @@ Follow one of the following sections based on your previous install method of th
5050
9. Navigate back to the menu at **Window > OneSignal SDK Setup** to see if there are any remaining steps to run
5151

5252
### Unitypackage Distributable
53-
1. Delete the directory at `Assets/OneSignal` and the xml file at `Assets/Plugins/Android/OneSignalConfig.plugin/AndroidManifest.xml`
53+
1. Delete the directory at `Assets/OneSignal`
5454
2. Download the latest release from our [releases page](https://github.com/OneSignal/OneSignal-Unity-SDK/releases)
5555
3. In Unity, navigate to **Assets > Import Package > Custom Package...** and select the newly downloaded `*.unitypackage` file
5656
4. Navigate to **Window > OneSignal SDK Setup**
57-
7. Click **Run All Steps**
58-
8. Follow the [API Reference](#api-reference) guide below to fix any compilation errors with the new namespaces and updated method calls
59-
9. Navigate back to the menu at **Window > OneSignal SDK Setup** to see if there are any remaining steps to run
57+
5. Click **Run All Steps**
58+
6. Follow the [API Reference](#api-reference) guide below to fix any compilation errors with the new namespaces and updated method calls
59+
7. Navigate back to the menu at **Window > OneSignal SDK Setup** to see if there are any remaining steps to run
6060

6161
## Code Modularization
6262

@@ -259,7 +259,7 @@ Assets/OneSignal/Example/OneSignalExampleBehaviou.cs: error CS0246: The type or
259259
Assets/OneSignal/Attribution/OneSignalVSAttribution.cs: error CS0117: 'OneSignal' does not contain a definition for '...'
260260
```
261261

262-
1. Delete the directory at `Assets/OneSignal` and the xml file at `Assets/Plugins/Android/OneSignalConfig.plugin/AndroidManifest.xml`
262+
1. Delete the directory at `Assets/OneSignal`
263263
- If you would like to regenerate the OneSignal assets, remove the OneSignal Unity SDK packages (Android, Core, iOS) from your project and import the OneSignal SDK again.
264264
2. Check the menu at **Window > OneSignal SDK Setup** to see if there are any remaining steps to run
265265

OneSignalExample/Assets/OneSignal/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
### Fixed
1313
- Sending VSAttribution data from the editor
1414
- iOS notifications clicked event firing if the app was cold started from clicking a notification
15+
- ClassNotFoundException: com.onesignal.OneSignal for Android builds with minify enabled. You must run the "Copy Android plugin to Assets" step in **Window > OneSignal SDK Setup**.
1516

1617
## [5.0.2]
1718
### Fixed

OneSignalExample/Assets/OneSignal/MIGRATION_GUIDE_v3_to_v5.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ OneSignal uses a built-in **alias label** called `external_id` which supports ex
3131
Follow one of the following sections based on your previous install method of the OneSignal SDK.
3232

3333
### Unity Package Manager
34-
1. If you have them, delete the directory at `Assets/OneSignal` and the xml file at `Assets/Plugins/Android/OneSignalConfig.plugin/AndroidManifest.xml`
34+
1. If you have it, delete the directory at `Assets/OneSignal`
3535
2. In Unity, open **Window > Package Manager**
3636
3. From the **Package Manager** window, select **Packages:** in the top left and click on **In Project**
3737
4. Select the OneSignal Unity SDK(s) and press the **Upgrade to 5.x.x** button (make sure to update both Android and iOS packages)
3838
5. Follow the [API Reference](#api-reference) guide below to fix any compilation errors with the new namespaces and updated method calls
3939
6. Check the menu at **Window > OneSignal SDK Setup** to see if there are any remaining steps to run
4040

4141
### Unity Asset Store
42-
1. Delete the directory at `Assets/OneSignal` and the xml file at `Assets/Plugins/Android/OneSignalConfig.plugin/AndroidManifest.xml`
42+
1. Delete the directory at `Assets/OneSignal`
4343
2. In Unity, open **Window > Package Manager**
4444
3. From the **Package Manager** window, select **Packages:** in the top left and click on **My Assets**
4545
4. Select the **OneSignal SDK** from the list and press the **Update** button.
@@ -50,13 +50,13 @@ Follow one of the following sections based on your previous install method of th
5050
9. Navigate back to the menu at **Window > OneSignal SDK Setup** to see if there are any remaining steps to run
5151

5252
### Unitypackage Distributable
53-
1. Delete the directory at `Assets/OneSignal` and the xml file at `Assets/Plugins/Android/OneSignalConfig.plugin/AndroidManifest.xml`
53+
1. Delete the directory at `Assets/OneSignal`
5454
2. Download the latest release from our [releases page](https://github.com/OneSignal/OneSignal-Unity-SDK/releases)
5555
3. In Unity, navigate to **Assets > Import Package > Custom Package...** and select the newly downloaded `*.unitypackage` file
5656
4. Navigate to **Window > OneSignal SDK Setup**
57-
7. Click **Run All Steps**
58-
8. Follow the [API Reference](#api-reference) guide below to fix any compilation errors with the new namespaces and updated method calls
59-
9. Navigate back to the menu at **Window > OneSignal SDK Setup** to see if there are any remaining steps to run
57+
5. Click **Run All Steps**
58+
6. Follow the [API Reference](#api-reference) guide below to fix any compilation errors with the new namespaces and updated method calls
59+
7. Navigate back to the menu at **Window > OneSignal SDK Setup** to see if there are any remaining steps to run
6060

6161
## Code Modularization
6262

@@ -259,7 +259,7 @@ Assets/OneSignal/Example/OneSignalExampleBehaviou.cs: error CS0246: The type or
259259
Assets/OneSignal/Attribution/OneSignalVSAttribution.cs: error CS0117: 'OneSignal' does not contain a definition for '...'
260260
```
261261

262-
1. Delete the directory at `Assets/OneSignal` and the xml file at `Assets/Plugins/Android/OneSignalConfig.plugin/AndroidManifest.xml`
262+
1. Delete the directory at `Assets/OneSignal`
263263
- If you would like to regenerate the OneSignal assets, remove the OneSignal Unity SDK packages (Android, Core, iOS) from your project and import the OneSignal SDK again.
264264
2. Check the menu at **Window > OneSignal SDK Setup** to see if there are any remaining steps to run
265265

OneSignalExample/Assets/OneSignal/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ And via many additional platforms. [Check them all out](https://documentation.on
3232
## Requirements
3333
- A [OneSignal Account](https://app.onesignal.com/signup) if you do not already have one
3434
- Your OneSignal App ID which you can find under **Settings > Keys & IDs**
35-
- Unity 2018.4 or newer
35+
- Unity 2021.3 or newer
3636
- iOS Builds: CocoaPods 1.11.3 or newer
3737
- In order to test push notifications you will need
3838
- An Android 4.0.3 or newer device or emulator with "Google Play services" installed
@@ -122,8 +122,8 @@ After building in Unity and exporting the XCode project follow these steps:
122122
### Android
123123
Most of the Android setup was already handled during installation!
124124
125-
The only thing remaining is to setup your own notification icons. You can do this be replacing the example icons located at `Assets/Plugins/Android/OneSignalConfig.plugin`
126-
with your own. There is a complete guide for this [in the plugin's README](com.onesignal.unity.android/Editor/OneSignalConfig.plugin/README.md). See our
125+
The only thing remaining is to setup your own notification icons. You can do this be replacing the example icons located at `Assets/Plugins/Android/OneSignalConfig.androidlib`
126+
with your own. There is a complete guide for this [in the plugin's README](com.onesignal.unity.android/Editor/OneSignalConfig.androidlib/README.md). See our
127127
[Customize Notification Icons](https://documentation.onesignal.com/docs/customize-notification-icons) page for additional details.
128128
129129
## Usage

OneSignalExample/Assets/OneSignalPackager/Editor/OneSignalSetupReset.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public static class OneSignalSetupReset {
4040
public static void ResetAllSteps() {
4141
/*
4242
* ExportAndroidResourcesStep
43-
* deletes the OneSignalConfig.plugin directory
43+
* deletes the OneSignalConfig.androidlib directory
4444
*/
45-
AssetDatabase.DeleteAsset(Path.Combine("Assets", "Plugins", "Android", "OneSignalConfig.plugin"));
45+
AssetDatabase.DeleteAsset(Path.Combine("Assets", "Plugins", "Android", "OneSignalConfig.androidlib"));
4646

4747
/*
4848
* InstallEdm4UStep

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin.meta renamed to OneSignalExample/Assets/Plugins/Android/OneSignalConfig.androidlib.meta

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

com.onesignal.unity.android/Editor/OneSignalConfig.plugin/README.md renamed to OneSignalExample/Assets/Plugins/Android/OneSignalConfig.androidlib/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ You must be sure the icon filenames are correct as per the above table. If you u
4848
have already been done for you.
4949

5050
### Step 2 - Add icons to project
51-
If you have already run our SDK setup wizard (found in the Unity Editor via the `Window > OneSignal` menu) then you will already have the
52-
`OneSignalConfig.plugin` imported into your project at the path `/Assets/Plugins/Android/OneSignalConfig.plugin`. If this is not the case
51+
If you have already run our SDK setup wizard (found in the Unity Editor via the `Window > OneSignal SDK Setup` menu) then you will already have the
52+
`OneSignalConfig.androidlib` imported into your project at the path `/Assets/Plugins/Android/OneSignalConfig.androidlib`. If this is not the case
5353
please run the step **"Copy Android plugin to Assets"** to do so. Once this is ready you can simply copy the files you made in step 1 to
5454
the correct paths:
5555

5656
| Path | Density (dp) | Size (px) |
5757
|------------------------------------------------------------------------------------------------------------|--------------|-----------|
58-
| Assets/Plugins/Android/OneSignalConfig.plugin/res/**drawable-mdpi**/ic_stat_onesignal_default.png | MDPI | 24x24 |
59-
| Assets/Plugins/Android/OneSignalConfig.plugin/res/**drawable-hdpi**/ic_stat_onesignal_default.png | HDPI | 36x36 |
60-
| Assets/Plugins/Android/OneSignalConfig.plugin/res/**drawable-xhdpi**/ic_stat_onesignal_default.png | XHDPI | 48x48 |
61-
| Assets/Plugins/Android/OneSignalConfig.plugin/res/**drawable-xxhdpi**/ic_stat_onesignal_default.png | XXHDPI | 72x72 |
62-
| Assets/Plugins/Android/OneSignalConfig.plugin/res/**drawable-xxxhdpi**/ic_stat_onesignal_default.png | XXXHDPI | 96x96 |
63-
| Assets/Plugins/Android/OneSignalConfig.plugin/res/**drawable-xxxhdpi**/ic_onesignal_large_icon_default.png | XXXHDPI | 256x256 |
58+
| Assets/Plugins/Android/OneSignalConfig.androidlib/src/main/res/**drawable-mdpi**/ic_stat_onesignal_default.png | MDPI | 24x24 |
59+
| Assets/Plugins/Android/OneSignalConfig.androidlib/src/main/res/**drawable-hdpi**/ic_stat_onesignal_default.png | HDPI | 36x36 |
60+
| Assets/Plugins/Android/OneSignalConfig.androidlib/src/main/res/**drawable-xhdpi**/ic_stat_onesignal_default.png | XHDPI | 48x48 |
61+
| Assets/Plugins/Android/OneSignalConfig.androidlib/src/main/res/**drawable-xxhdpi**/ic_stat_onesignal_default.png | XXHDPI | 72x72 |
62+
| Assets/Plugins/Android/OneSignalConfig.androidlib/src/main/res/**drawable-xxxhdpi**/ic_stat_onesignal_default.png | XXXHDPI | 96x96 |
63+
| Assets/Plugins/Android/OneSignalConfig.androidlib/src/main/res/**drawable-xxxhdpi**/ic_onesignal_large_icon_default.png | XXXHDPI | 256x256 |
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
sourceSets {
5+
main {
6+
manifest.srcFile 'AndroidManifest.xml'
7+
}
8+
}
9+
10+
defaultConfig {
11+
consumerProguardFiles "consumer-proguard.pro"
12+
}
13+
14+
compileSdkVersion 31
15+
16+
lintOptions {
17+
abortOnError false
18+
}
19+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-keep class com.onesignal.** { *; }
2+
3+
# Work around for IllegalStateException with kotlinx-coroutines-android
4+
-keep class kotlinx.coroutines.android.AndroidDispatcherFactory {*;}

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/AndroidManifest.xml.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/README.md.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/project.properties

Lines changed: 0 additions & 15 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/project.properties.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/res.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/res/drawable-hdpi.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/res/drawable-hdpi/ic_stat_onesignal_default.png.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/res/drawable-mdpi.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/res/drawable-mdpi/ic_stat_onesignal_default.png.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/res/drawable-xhdpi.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/res/drawable-xhdpi/ic_stat_onesignal_default.png.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/res/drawable-xxhdpi.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/res/drawable-xxhdpi/ic_stat_onesignal_default.png.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/res/drawable-xxxhdpi.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/res/drawable-xxxhdpi/ic_onesignal_large_icon_default.png.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/res/drawable-xxxhdpi/ic_stat_onesignal_default.png.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/res/raw.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

OneSignalExample/Assets/Plugins/Android/OneSignalConfig.plugin/res/raw/notification.wav.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ And via many additional platforms. [Check them all out](https://documentation.on
3232
## Requirements
3333
- A [OneSignal Account](https://app.onesignal.com/signup) if you do not already have one
3434
- Your OneSignal App ID which you can find under **Settings > Keys & IDs**
35-
- Unity 2018.4 or newer
35+
- Unity 2021.3 or newer
3636
- iOS Builds: CocoaPods 1.11.3 or newer
3737
- In order to test push notifications you will need
3838
- An Android 5 or newer device or emulator with "Google Play Store (Services)" installed
@@ -129,8 +129,8 @@ In the Unity editor:
129129
130130
Most of the Android setup was already handled during installation!
131131
132-
The only thing remaining is to setup your own notification icons. You can do this be replacing the example icons located at `Assets/Plugins/Android/OneSignalConfig.plugin`
133-
with your own. There is a complete guide for this [in the plugin's README](com.onesignal.unity.android/Editor/OneSignalConfig.plugin/README.md). See our
132+
The only thing remaining is to setup your own notification icons. You can do this be replacing the example icons located at `Assets/Plugins/Android/OneSignalConfig.androidlib`
133+
with your own. There is a complete guide for this [in the plugin's README](com.onesignal.unity.android/Editor/OneSignalConfig.androidlib/README.md). See our
134134
[Customize Notification Icons](https://documentation.onesignal.com/docs/customize-notification-icons) page for additional details.
135135
136136
## Usage

0 commit comments

Comments
 (0)