Knowing that my android/build.gradle
is:
buildscript {
ext.kotlin_version = '2.1.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.15'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
afterEvaluate { project ->
// check only for "com.android.library" to not modify
// your "app" subproject. All plugins will have "com.android.library" plugin, and only your app "com.android.application"
// Change your application's namespace in main build.gradle and in main android block.
if (project.plugins.hasPlugin("com.android.library")) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
}
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
When I run flutter run --debug
to compile my APK (from Flutter App), I get:
PS C:\Users\useru\Downloads\EDITED\flutter_driver> flutter run --debug
Launching lib\main.dart on sdk gphone x86 64 in debug mode...
Checking the license for package Android SDK Platform 30 in C:\Users\useru\AppData\Local\Android\sdk\licenses
License for package Android SDK Platform 30 accepted.
Preparing "Install Android SDK Platform 30 (revision 3)".
"Install Android SDK Platform 30 (revision 3)" ready.
Installing Android SDK Platform 30 in C:\Users\useru\AppData\Local\Android\sdk\platforms\android-30
"Install Android SDK Platform 30 (revision 3)" complete.
"Install Android SDK Platform 30 (revision 3)" finished.
Note: C:\Users\useru\AppData\Local\Pub\Cache\hosted\pub.dev\bubble_head-0.0.4\android\src\main\java\com\dsaved\bubblehead\bubble\BubbleHeadService.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\useru\AppData\Local\Pub\Cache\hosted\pub.dev\device_apps-2.2.0\android\src\main\java\fr\g123k\deviceapps\DeviceAppsPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
e: file:///C:/Users/useru/AppData/Local/Pub/Cache/hosted/pub.dev/dash_bubble-2.0.0/android/src/main/kotlin/dev/moaz/dash_bubble/src/BubbleService.kt:65:24 Unresolved reference 'ic_close_bubble'.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dash_bubble:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 3m 44s
Running Gradle task 'assembleDebug'... 226,0s
Error: Gradle task assembleDebug failed with exit code 1
PS C:\Users\useru\Downloads\EDITED\flutter_driver>
Can anyone help me please ???
After some investigation, I found a solution to your issue.
The problem is not in your code but in the dash_bubble
package, specifically in the BubbleService.kt
file.
Error Details:
The error occurs in this path in the package:
file:///C:/Users/useru/AppData/Local/Pub/Cache/hosted/pub.dev/dash_bubble-2.0.0/android/src/main/kotlin/dev/moaz/dash_bubble/src/BubbleService.kt'.
The error message indicates that there is an unresolved reference to ic_close_bubble
.
This typically means that the resource ic_close_bubble
is missing or not properly referenced in your project.
And if you locate the res/drawable
directory in the package you will not find any ic_close_bubble
image
Steps to Fix the Issue:
1. In your project, navigate to the DEPENDENCIES
section in VS Code
(located in the bottom-left corner).
2. Open the file: android/src/main/kotlin/dev/moaz/dash_bubble/src/BubbleService.kt
3. Locate the Issue:
val closeIcon = Helpers.getDrawableId(
applicationContext,
bubbleOptions.closeIcon, <------- the issue
R.drawable.ic_close_bubble <------- the issue
)
ic_close_bubble
is missing.4. Replace the Missing Resource:
closeIcon
which is missed you will use the icon of the default_bubble_icon
val closeIcon = Helpers.getDrawableId(
applicationContext,
bubbleOptions.bubbleIcon, <------ Use the bubbleIcon
R.drawable.default_bubble_icon <------ Use the bubbleIcon
)
bubbleIcon
is defined in the following val
: val bubbleIcon = Helpers.getDrawableId(
applicationContext,
bubbleOptions.bubbleIcon,
R.drawable.default_bubble_icon
)
then run:
flutter clear
flutter pub get
Not:
The initial icon of the close icon (
ic_close_bubble
) will be the same icon as the bubble icon (default_bubble_icon
)
You can check the source code of the package also: package_source_code