Skip to content

Commit af97310

Browse files
authored
Upgrade minimum required Flutter version to 1.12 for our example application (#76)
Supress the following warning generated when running the example application with any flutter version > 1.12. We are using modules that have been deprecated in Flutter SDK version 1.12. Running the Android emulator app produces the following warning of deprecation: ``` ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Warning ────────────────────────────────────────────────────────────────────────────── Your Flutter application is created using an older version of the Android embedding. It's being deprecated in favor of Android embedding v2. Follow the steps at https://flutter.dev/go/android-project-migration to migrate your project. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ``` The changes in this PR apply the steps outlined in https://flutter.dev/go/android-project-migration Note: this only affects running the example. Our plugin is still backwards compatible to older versions.
1 parent 5d22813 commit af97310

File tree

6 files changed

+25
-59
lines changed

6 files changed

+25
-59
lines changed

android/config.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if (pspdfkitVersion == null || pspdfkitVersion == '') {
3131

3232
ext.pspdfkitMavenModuleName = 'pspdfkit'
3333

34-
ext.pspdfkitFlutterVersion = '1.10.0'
34+
ext.pspdfkitFlutterVersion = '1.10.3'
3535

3636
ext.androidCompileSdkVersion = 29
3737
ext.androidBuildToolsVersion = '29.0.1'

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,33 @@
1515
-->
1616
<uses-permission android:name="android.permission.INTERNET"/>
1717

18-
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
19-
calls FlutterMain.startInitialization(this); in its onCreate method.
20-
In most cases you can leave this as-is, but you if you want to provide
21-
additional functionality it is fine to subclass or reimplement
22-
FlutterApplication and put your custom class here. -->
2318
<application
24-
android:name="com.pspdfkit.flutter.example.FlutterExampleApplication"
19+
android:name="androidx.multidex.MultiDexApplication"
2520
android:label="pspdfkit_example"
2621
android:icon="@mipmap/ic_launcher">
2722
<activity
28-
android:name="com.pspdfkit.flutter.example.MainActivity"
23+
android:name="io.flutter.embedding.android.FlutterActivity"
2924
android:launchMode="singleTop"
3025
android:theme="@style/LaunchTheme"
3126
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
3227
android:hardwareAccelerated="true"
3328
android:windowSoftInputMode="adjustResize">
34-
<!-- This keeps the window background of the activity showing
35-
until Flutter renders its first frame. It can be removed if
36-
there is no splash screen (such as the default splash screen
37-
defined in @style/LaunchTheme). -->
29+
<!-- Specify that the launch screen should continue being displayed -->
30+
<!-- until Flutter renders its first frame. -->
3831
<meta-data
39-
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
40-
android:value="true" />
32+
android:name="io.flutter.embedding.android.SplashScreenDrawable"
33+
android:resource="@drawable/launch_background" />
34+
<!-- Theme to apply as soon as Flutter begins rendering frames -->
35+
<meta-data
36+
android:name="io.flutter.embedding.android.NormalTheme"
37+
android:resource="@style/NormalTheme" />
4138
<intent-filter>
4239
<action android:name="android.intent.action.MAIN"/>
4340
<category android:name="android.intent.category.LAUNCHER"/>
4441
</intent-filter>
4542
</activity>
43+
<meta-data
44+
android:name="flutterEmbedding"
45+
android:value="2" />
4646
</application>
4747
</manifest>

example/android/app/src/main/java/com/pspdfkit/flutter/example/FlutterExampleApplication.java

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

example/android/app/src/main/java/com/pspdfkit/flutter/example/MainActivity.java

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

example/android/app/src/main/res/values/styles.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,13 @@
1313
Flutter draws its first frame -->
1414
<item name="android:windowBackground">@drawable/launch_background</item>
1515
</style>
16+
<!-- Theme applied to the Android Window as soon as the process has started.
17+
This theme determines the color of the Android Window while your
18+
Flutter UI initializes, as well as behind your Flutter UI while its
19+
running.
20+
21+
This Theme is only used starting with V2 of Flutter's Android embedding. -->
22+
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
23+
<item name="android:windowBackground">?android:colorBackground</item>
24+
</style>
1625
</resources>

example/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ author: PSPDFKit
55
homepage: https://pspdfkit.com/
66
environment:
77
sdk: '>=2.0.0 <3.0.0'
8+
flutter: ">=1.12.0 <2.0.0"
89

910
dependencies:
1011
flutter:
@@ -32,7 +33,7 @@ flutter:
3233
# included with your application, so that you can use the icons in
3334
# the material Icons class.
3435
uses-material-design: true
35-
36+
3637
assets:
3738
- PDFs/
3839
- PDFs/Instant/

0 commit comments

Comments
 (0)