Skip to content

Commit 4c2e760

Browse files
authored
Add support for AGP 8.4 (#120)
* android: bump minSdkVersion to 21 Fixes the following error with AGP 8.4: A problem occurred configuring project ':webcrypto'. > [CXX1110] Platform version 16 is unsupported by this NDK. Please change minSdk to at least 21 to avoid undefined behavior. To suppress this error, add android.ndk.suppressMinSdkVersionError=21 to the project's gradle.properties or set android.experimentalProperties["android.ndk.suppressMinSdkVersionError"]=21 in the Gradle build file. * android: drop package attribute from AndroidManifest.xml Fixes the following error with AGP 8.4: Execution failed for task ':webcrypto:processReleaseManifest'. > A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction > Incorrect package="com.example.webcrypto" found in source AndroidManifest.xml: /home/simon/src/webcrypto.dart/android/src/main/AndroidManifest.xml. Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported. Recommendation: remove package="com.example.webcrypto" from the source AndroidManifest.xml: /home/simon/src/webcrypto.dart/android/src/main/AndroidManifest.xml. * example: build.gradle automatic upgrade These changes are made automatically by the flutter tool when running "flutter build apk". * example: upgrade to AGP 8.4 This is done via the Android Studio AGP upgrade assistant. * ci: upgrade Java to version 21 Java 11 is not new enough for AGP 8.4.
1 parent 56dc3db commit 4c2e760

File tree

10 files changed

+19
-18
lines changed

10 files changed

+19
-18
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ jobs:
121121
with:
122122
channel: 'stable'
123123
cache: true
124+
- uses: actions/setup-java@v4
125+
with:
126+
distribution: 'zulu'
127+
java-version: 21
124128
- name: Configure Flutter
125129
run: |
126130
flutter config --no-analytics

android/build.gradle

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ apply plugin: 'com.android.library'
2525
apply plugin: 'kotlin-android'
2626

2727
android {
28-
// Conditional for compatibility with AGP <4.2.
29-
if (project.android.hasProperty("namespace")) {
30-
namespace 'dev.google.webcrypto'
31-
}
28+
namespace 'dev.google.webcrypto'
3229

3330
compileSdkVersion 31
3431

@@ -53,7 +50,7 @@ android {
5350
}
5451

5552
defaultConfig {
56-
minSdkVersion 16
53+
minSdkVersion 21
5754
ndk {
5855
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
5956
}

android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@
1414
limitations under the License.
1515
-->
1616

17-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
18-
package="com.example.webcrypto">
17+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
1918
</manifest>

example/android/app/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ android {
4545
defaultConfig {
4646
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4747
applicationId "com.example.webcrypto_example"
48-
minSdkVersion 16
48+
minSdkVersion flutter.minSdkVersion
4949
targetSdkVersion 31
5050
versionCode flutterVersionCode.toInteger()
5151
versionName flutterVersionName
@@ -58,6 +58,7 @@ android {
5858
signingConfig signingConfigs.debug
5959
}
6060
}
61+
namespace 'com.example.webcrypto_example'
6162
}
6263

6364
flutter {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
limitations under the License.
1515
-->
1616

17-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
18-
package="com.example.webcrypto_example">
17+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
1918
<!-- The INTERNET permission is required for development. Specifically,
2019
the Flutter tool needs it to communicate with the running application
2120
to allow setting breakpoints, to provide hot reload, etc.

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
limitations under the License.
1515
-->
1616

17-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
18-
package="com.example.webcrypto_example">
17+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
1918
<application
2019
android:label="webcrypto_example"
2120
android:name="${applicationName}"

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
limitations under the License.
1515
-->
1616

17-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
18-
package="com.example.webcrypto_example">
17+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
1918
<!-- The INTERNET permission is required for development. Specifically,
2019
the Flutter tool needs it to communicate with the running application
2120
to allow setting breakpoints, to provide hot reload, etc.

example/android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
buildscript {
2-
ext.kotlin_version = '1.6.10'
2+
ext.kotlin_version = '1.6.21'
33
repositories {
44
google()
55
mavenCentral()
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.1.2'
9+
classpath 'com.android.tools.build:gradle:8.4.1'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}
@@ -26,6 +26,6 @@ subprojects {
2626
project.evaluationDependsOn(':app')
2727
}
2828

29-
task clean(type: Delete) {
29+
tasks.register("clean", Delete) {
3030
delete rootProject.buildDir
3131
}

example/android/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
org.gradle.jvmargs=-Xmx1536M
22
android.useAndroidX=true
33
android.enableJetifier=true
4+
android.defaults.buildfeatures.buildconfig=true
5+
android.nonTransitiveRClass=false
6+
android.nonFinalResIds=false

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip

0 commit comments

Comments
 (0)