-
Notifications
You must be signed in to change notification settings - Fork 845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hard to build an APK when using this package #1588
Labels
Comments
ThomasGysemans
changed the title
Impossible to build an APK when using this package
Hard to build an APK when using this package
Jul 30, 2023
Can you post your original build.gradle files plz? |
Here buildscript {
// I eventually had to change this to `1.8.0`
// The first time because of this error during release build: https://docs.flutter.dev/release/breaking-changes/kotlin-version
// The second time (on another project) because of the error shown above
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
} Here def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
// This was added according to https://docs.flutter.dev/deployment/android
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
namespace "com.example.audioplayers_damn"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.audioplayers_damn"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 23 // As recommended
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
// This was added according to https://docs.flutter.dev/deployment/android
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
} |
I have the same problem. |
7 tasks
You're right, AGP 7 support has mistakenly dropped by bumping a gradle dependency, I added a PR to fix :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Checklist
Current bug behaviour
It is impossible to use this package when building an APK of a Flutter app.
I tried to build an APK as explained on the official documentation and I get an extremely annoying error.
I use this command:
Which gives a warning (but the build goes on):
On the result, the audio player just doesn't appear (it raises an exception).
Expected behaviour
The error should not appear.
Steps to reproduce
Create a new Flutter Mobile App
Install the package audioplayers (version 5.0.0)
Set the
minSdkVersion
to 23 as advised hereI run the app on a Android device:
That's when I got this build error:
Error that is fixed by changing:
to
Then I just followed the documentation to build an APK and ran:
Code sample
No need to touch any dart code.
Affected platforms
Android
Platform details
No response
AudioPlayers Version
5.0.0
Build mode
release
Audio Files/URLs/Sources
No response
Screenshots
No response
Logs
Full Logs
I already gave everything above.
Flutter doctor (which is a mess for unknown reasons):
Related issues / more information
No response
Working on PR
no way
The text was updated successfully, but these errors were encountered: