Flutter image_picker not working with flutter_plugin_android_lifecycle issue - image

I have followed all the steps to implement the image picker plugin in a fresh new app.
Added dependencies to pubspec.yaml
dependencies:
image_picker: 0.6.2+3
Added to the menifest
android:requestLegacyExternalStorage="true"
Followed the example code, But I am getting is this error..
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
../project/android/app/src/main/AndroidManifest.xml:9:5-53:19: AAPT: error: attribute android:requestLegacyExternalStorage not found.
and
/Users/.../Documents/_sdk/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.8/android/src/main/java/io/flutter/embedding/engine/plugins/lifecycle/FlutterLifecycleAdapter.java:8: error: package androidx.lifecycle does not exist
import androidx.lifecycle.Lifecycle;
^
/Users/.../Documents/_sdk/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.8/android/src/main/java/io/flutter/embedding/engine/plugins/lifecycle/FlutterLifecycleAdapter.java:22: error: cannot find symbol
public static Lifecycle getActivityLifecycle(
^
symbol: class Lifecycle
location: class FlutterLifecycleAdapter
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for 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 1s
Exception: The plugin flutter_plugin_android_lifecycle could not be built due to the issue above.
Whats the wrong am I doing here!

After an intensive search, i got the clue to solved this issue. The app need to compile against SDK 29, which is the latest buildTool includes the latest changes that were introduced in Android 10.
Inside app level build.gradle file
// ...
android {
compileSdkVersion 29
// ....
defaultConfig {
targetSdkVersion 29
//...
I think this should be mentioned in the image_picker documentation.

Related

Xcode fails to build KMM project due to shared:linkPodDebugFrameworkIos

I am building a small project with KMM, it builds perfectly fine on android but cannot build it in XCode. Cocoapods was also installed an genereted without any erros.
What I'm using:
macbook air m1
Kotlin 1.6.10,
gradle 7.3.0-alpha03
Ktor 1.5.2,
SQLDelight 1.4.3,
You can find the project here: https://github.com/PiotrKedra/comperative-analysis-of-kmm-flutter-react-native/tree/master/preapp-kmm
The error I got:
...
> Task :shared:linkPodDebugFrameworkIos FAILED
e: Compilation failed: Backend Internal error: Exception during IR lowering
File being compiled: /opt/buildAgent/work/b2fef8360e1bcf3d/formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonDecoder.kt
The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.ir.util.IrFakeOverrideUtilsKt.getTarget(IrFakeOverrideUtils.kt:24)
* Source files:
* Compiler version info: Konan: 1.6.10 / Kotlin: 1.6.10
* Output kind: FRAMEWORK
e: org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
File being compiled: /opt/buildAgent/work/b2fef8360e1bcf3d/formats/json/commonMain/src/kotlinx/serialization/json/internal/TreeJsonDecoder.kt
The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.ir.util.IrFakeOverrideUtilsKt.getTarget(IrFakeOverrideUtils.kt:24)
...
Caused by: java.lang.IllegalStateException: Could not resolveFakeOverride() for FUN FAKE_OVERRIDE name:decodeNullableSerializableElement visibility:public modality:OPEN <T> ($this:kotlinx.serialization.encoding.CompositeDecoder, descriptor:kotlinx.serialization.descriptors.SerialDescriptor, i:kotlin.Int, deserializer:kotlinx.serialization.DeserializationStrategy<T of kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeNullableSerializableElement?>) returnType:T of kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeNullableSerializableElement? [fake_override]
at org.jetbrains.kotlin.ir.util.IrFakeOverrideUtilsKt.getTarget(IrFakeOverrideUtils.kt:24)
...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':shared:linkPodDebugFrameworkIos'.
> Compilation finished with errors
For Kotlin 1.6.10, you need Ktor that was build on Kotlin 1.6.10. Ktor 1.6.8 is what you need. You will also need to inclode Kotlinx.serialization into the common module. Currently, you only have the plugin for Ktor (I'm guessing you are trying to deserialize network calls directly into appropriate data classes).

how do I add JavaFX to a gradle build file using Kotlin DSL?

how do I add the javafx dependencies through gradle?
thufir#dur:~/NetBeansProjects/helloWorldJavaFX$
thufir#dur:~/NetBeansProjects/helloWorldJavaFX$ gradle clean
> Configure project :
e: /home/thufir/NetBeansProjects/helloWorldJavaFX/build.gradle.kts:13:7: Unresolved reference: openjfx
FAILURE: Build failed with an exception.
* Where:
Build file '/home/thufir/NetBeansProjects/helloWorldJavaFX/build.gradle.kts' line: 13
* What went wrong:
Script compilation error:
Line 13: org.openjfx.javafxplugin
^ Unresolved reference: openjfx
1 error
* 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 1s
thufir#dur:~/NetBeansProjects/helloWorldJavaFX$
the manual says:
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.7'
}
my build file has:
plugins {
// Apply the java plugin to add support for Java
java
org.openjfx.javafxplugin
// Apply the application plugin to add support for building an application
application
}
which is generating the above error.
in the plugins-section you have to put
id("org.openjfx.javafxplugin") version "0.0.8"
instead of just org.openjfx.javafxplugin.
After that you can put a javafx-section like
javafx {
modules("javafx.controls", "javafx.fxml")
}
somewhere (I prefere to put it next to the dependency-section). Here you can put in any module you need.
For further configuration posibilities have a look JavaFX Gradle Plugin.

Converting maven to gradle of Spring Initializr

Spring Initializr is a open source project , which can be downloaded/cloned from github to run our own spring initializr. however the build of the project is maven. I want to convert it to gradle. Can anyone Help ?
I tried it with gradle init and gradle build
Gradle init is creating build.gradle and settings.gradle but gradle build is giving error.
Can someone try and post the solution
Thanks in advance
Error Details :
Task :initializr-actuator:compileTestJava FAILED
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\ActuatorIntegrationTests.java:19: error: package io.spring.initializr.web does not exist
import io.spring.initializr.web.AbstractFullStackInitializrIntegrationTests;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\ActuatorIntegrationTests.java:35: error: cannot find symbol
extends AbstractFullStackInitializrIntegrationTests {
^
symbol: class AbstractFullStackInitializrIntegrationTests
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\info\BomRangesInfoContributorTests.java:24: error: package io.spring.initializr.test.metadata does not exist
import io.spring.initializr.test.metadata.InitializrMetadataTestBuilder;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\metric\ProjectGenerationMetricsListenerTests.java:28: error: package io.spring.initializr.test.metadata does not exist
import io.spring.initializr.test.metadata.InitializrMetadataTestBuilder;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\stat\AbstractInitializrStatTests.java:23: error: package io.spring.initializr.test.metadata does not exist
import io.spring.initializr.test.metadata.InitializrMetadataTestBuilder;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\stat\MainControllerStatsIntegrationTests.java:24: error: package io.spring.initializr.web does not exist
import io.spring.initializr.web.AbstractFullStackInitializrIntegrationTests;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\stat\MainControllerStatsIntegrationTests.java:56: error: cannot find symbol
extends AbstractFullStackInitializrIntegrationTests {
^
symbol: class AbstractFullStackInitializrIntegrationTests
7 errors
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':initializr-actuator:compileTestJava'.
Compilation failed; see the compiler error output for 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 4s
11 actionable tasks: 1 executed, 10 up-to-date
Instead of converting that you can generate fresh project from following url:
https://start.spring.io/
Select Gradle Project and download the code.

libgdx project generation gradle error

I'm trying to generate a libgdx project but I'm getting the following error related to gradle.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\libgdx\gametest\build.gradle' line: 5
* What went wrong:
Could not compile build file 'C:\libgdx\gametest\build.gradle'.
> startup failed:
build file 'C:\libgdx\gametest\build.gradle': 5: unexpected token: } # line 5, column 5.
}
^
1 error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Is there any way to fix this? Thanks!
This is really simple. Open the grade file. Change line 5 from
maven { https://oss.sonatype.org/content/repositories/snapshots/ }
to:
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }

RedPhone Build Failed

I tried to build Redphone for my android device using gradle.
I always get the following error
FAILURE: Build failed with an exception
* What went wrong:
Execution failed for task ':lint'.
> Lint found errors with abortOnError=true; aborting build.
What exactly is the error and how to correct.
Please Help.
The build can be completed by adding the following to build.gradle
android {
lintOptions {
abortOnError false
}
}
Tried the solution by Scott Barta and Jared Burrows at How to fix error running ./gradlew check connectedCheck, after update AndroidStudio to 0.4.0? and it worked.

Resources