Problem with url_launcher package (Flutter) - gradle

I’m working on a Flutter project. I’m starting with the counter app. If a use the following packages, I have not any problem:
cupertino_icons: ^0.1.3
flutter_markdown: ^0.3.3
google_fonts: ^0.3.9
google_maps_flutter: ^0.5.23+1
intl: ^0.16.1
provider: ^4.0.4
rive: ^0.0.1
rxdart: ^0.23.1
shared_preferences: ^0.5.6+1
But if I use the url_launcher: ^5.4.1 package, I receive this error:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':url_launcher:compileDebugAidl'.
> Could not resolve all task dependencies for configuration ':url_launcher:debugCompileClasspath'.
> Could not resolve androidx.annotation:annotation:1.1.0.
Required by:
project :url_launcher
[...]
How can I solve? Thank you!

With version 5.4.2 of the package the problem seems to be solved.

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).

Nativescript Angular compiling error "mergeDexDebug"

I am using nativescript v6.4 and angular v8.2 and in project i have install 4-5 plugin and it work fine but after installing one more plugin i.e nativescript-firebase-plugin i got this error when compiling the project.
Execution failed for task ':app:mergeDexDebug'.
Error: null, Cannot fit requested classes in a single dex file (# methods: 132015 > 65536 ; # fields: 77460 > 65536)
Did you go through the documentation of Firebase Plugin?
Adding multiDexEnabled true to your app/App_Resources/Android/app.gradle should solve the issue

Nativescript: runtime exception on tns run

When I execute tns run android to test my code, it produces this runtime error:
Gradle build...
+ setting applicationId
+ applying user-defined configuration from C:\Users\Ace\eclipse-workspace\arenamaster\App_Resources\Android\app.gradle
+ using android X library androidx.legacy:legacy-support-v4:1.0.0
+ adding nativescript runtime package dependency: nativescript-optimized-with-inspector
Exception in thread "main" java.lang.RuntimeException: Class not found org.nativescript.widgets.image.Worker.OnImageLoadedListener
at org.nativescript.staticbindinggenerator.Generator.getClass(Generator.java:549)
at org.nativescript.staticbindinggenerator.Generator.getInterfacesFromCache(Generator.java:532)
at org.nativescript.staticbindinggenerator.Generator.writeBinding(Generator.java:283)
at org.nativescript.staticbindinggenerator.Generator.generateBinding(Generator.java:171)
at org.nativescript.staticbindinggenerator.Generator.processRows(Generator.java:234)
at org.nativescript.staticbindinggenerator.Generator.generateBindings(Generator.java:121)
at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:97)
at org.nativescript.staticbindinggenerator.Main.main(Main.java:53)
I have tried the following:
Deleting my .tns.ts files and reverting code splitting
Migrating the project to androidX
Deleting the platforms directory then running tns run android
nativescript core modules requires a package called nativescript core modules widgets
If you get this error run npm i nativescript-core-modules-widgets
Just noting that with NativeScript 7.x and higher, the answer from #ace zhang is no longer needed. All that's needed is:
"#nativescript/core": "^7.0.0"

Error when trying to run 'gradlew assembleRelease' in the Windows command line : jest-haste-map: Haste module naming collision

I am trying to generate a .apk file of my react native project with the 'gradlew assembleRelease' command. I'm using AWS Amplify, which is where the naming collision seems to be coming from. The version of react native I'm running is 0.59.9.
I've tried creating a 'rn-cli.config.js' file in the root folder and replacing the code in the 'metro.config.js' with the 'rn-cli.config.js' code, which was unsuccessful. I can't remove the problem folder either because that creates more errors.
I've also tried stopping and restarting the Gradle daemon, which hasn't worked either. This is the error I'm getting:
Configure project :app
WARNING: The specified Android SDK Build Tools version (25.0.0) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.4.0.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.0'" from your build.gradle file, as each version of the Android Gradle Plugin now has a
default version of the build tools.
Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
error jest-haste-map: Haste module naming collision:
Duplicate module name: myreactnativeapp_cfnlambda_ff57ce62
Paths: C:\Users\Kim\Desktop\myReactNativeApp\amplify\backend\interactions\reactLex\src\package.json collides with C:\Users\Kim\Desktop\myReactNativeApp\amplify#current-cloud-backend\interactions\reactLex\src\package.json
This error is caused by hasteImpl returning the same name for different files.. Run CLI with --verbose flag for more details.
Task :app:bundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
Process 'command 'cmd'' finished with non-zero exit value 1
The code in the 'rn-cli.config.js' file looks like this:
const blacklist = require('metro-config/src/defaults/blacklist');
// blacklist is a function that takes an array of regexes and combines
// them with the default blacklist to return a single regex.
module.exports = {
resolver: {
blacklistRE: blacklist([/amplify\/.*/])
}
};'
Do I need to change the code in the 'rn-cli.config.js' file or is there another workaround I could try?

nativescript-onesignal fails android build

I tried installing package nativescript-onesignal. After that, I got an error like UNMET PEER DEPENDANCY. Then I updated my modules following some posts on GitHub and StackOverflow. But, now when I try to build and run the application I got BUILD FAILED error. Unable to understand what went wrong. I followed some posts to resolve this but with no success.
Following is the error I got in the console.
tns run android
Searching for devices...
Preparing project...
Successfully prepared plugin nativescript-camera for android.
Successfully prepared plugin nativescript-carousel for android.
Successfully prepared plugin nativescript-drop-down for android.
Successfully prepared plugin nativescript-filter-select for android.
Successfully prepared plugin nativescript-geolocation for android.
Successfully prepared plugin nativescript-gradient for android.
Successfully prepared plugin nativescript-imagepicker for android.
nativescript-iqkeyboardmanager is not supported for android.
Successfully prepared plugin nativescript-iqkeyboardmanager for android.
Successfully prepared plugin nativescript-loading-indicator for android.
Successfully prepared plugin nativescript-localstorage for android.
Successfully prepared plugin nativescript-locate-address for android.
Successfully prepared plugin nativescript-numeric-keyboard for android.
Successfully prepared plugin nativescript-onesignal for android.
Successfully prepared plugin nativescript-phone for android.
Successfully prepared plugin nativescript-social-share for android.
Successfully prepared plugin nativescript-telerik-ui for android.
Successfully prepared plugin nativescript-theme-core for android.
Successfully prepared plugin nativescript-webview-interface for android.
Successfully prepared plugin tns-core-modules for android.
Successfully prepared plugin tns-i18n for android.
Successfully prepared plugin nativescript-permissions for android.
Successfully prepared plugin tns-core-modules-widgets for android.
Starting a Gradle Daemon, 2 incompatible and 2 stopped Daemons could not be reused, use --status for details
> Configuring > 0/3 projects > root project
:config phase: createDefaultIncludeFiles
> Configuring > 0/3 projects > root project
:config phase: addAarDependencies
+adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\Common-2017.1.719-dev-release.aar
+adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\Data-2017.1.719-dev-release.aar
+adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\List-2017.1.719-dev-release.aar
+adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\Primitives-2017.1.719-dev-release.aar
+adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\widgets-release.aar
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
Incremental java compilation is an incubating feature.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_2xnifqnj4smqh1ggt6ywlsjt4.run(C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\build-tools\android-static-binding-generator\build.gradle:144)
:asbg:clean UP-TO-DATE
:deleteMetadata
:deleteFlavors
:deleteConfigurations UP-TO-DATE
:deleteGeneratedBindings UP-TO-DATE
:clean
BUILD SUCCESSFUL
Total time: 30.954 secs
Project successfully prepared (Android)
Building project...
> Configuring > 0/3 projects > root project
:config phase: createDefaultIncludeFiles
+found plugins: nativescript-camera
+ creating include.gradle file for C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-camera
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-camera -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F0
+found plugins: nativescript-carousel
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-carousel -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F1
+found plugins: nativescript-geolocation
+ creating include.gradle file for C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-geolocation
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-geolocation -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F2
+found plugins: nativescript-imagepicker
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-imagepicker -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F3
+found plugins: nativescript-onesignal
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-onesignal -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F4
+found plugins: nativescript-phone
+ creating include.gradle file for C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-phone
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-phone -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F5
+found plugins: nativescript-telerik-ui
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-telerik-ui -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F6
+found plugins: nativescript-webview-interface
+ creating include.gradle file for C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-webview-interface
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\nativescript-webview-interface -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F7
+found plugins: tns-core-modules-widgets
+ creating include.gradle file for C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\tns-core-modules-widgets
Renaming plugin directory to flavor name: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\tns-core-modules-widgets -> C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F8
> Configuring > 0/3 projects > root project
:config phase: createPluginsConfigFile
Creating product flavors include.gradle file in C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android/configurations folder...
:config phase: pluginExtend
+applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\include.gradle
+applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-camera\include.gradle
+applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-carousel\include.gradle
+applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-geolocation\include.gradle
+applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-imagepicker\include.gradle
+applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-onesignal\include.gradle
+applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-phone\include.gradle
+applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-telerik-ui\include.gradle
+applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\nativescript-webview-interface\include.gradle
+applying configuration from: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\configurations\tns-core-modules-widgets\include.gradle
> Configuring > 0/3 projects > root project
:config phase: addAarDependencies
+adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\Common-2017.1.719-dev-release.aar
+adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\Data-2017.1.719-dev-release.aar
+adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\List-2017.1.719-dev-release.aar
+adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\Primitives-2017.1.719-dev-release.aar
+adding dependency: C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\libs\aar\widgets-release.aar
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
Incremental java compilation is an incubating feature.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_2xnifqnj4smqh1ggt6ywlsjt4.run(C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\build-tools\android-static-binding-generator\build.gradle:144)
:preBuild UP-TO-DATE
:preF0F1F2F3F4F5F6F7F8DebugBuild UP-TO-DATE
:checkF0F1F2F3F4F5F6F7F8DebugManifest
:preF0F1F2F3F4F5F6F7F8ReleaseBuild UP-TO-DATE
:prepareAquaappRuntimeUnspecifiedLibrary
:prepareComAndroidSupportAnimatedVectorDrawable2600Alpha1Library
:prepareComAndroidSupportAppcompatV72600Alpha1Library
:prepareComAndroidSupportDesign2600Alpha1Library
:prepareComAndroidSupportRecyclerviewV72600Alpha1Library
:prepareComAndroidSupportSupportCompat2600Alpha1Library
:prepareComAndroidSupportSupportCoreUi2600Alpha1Library
:prepareComAndroidSupportSupportCoreUtils2600Alpha1Library
:prepareComAndroidSupportSupportFragment2600Alpha1Library
:prepareComAndroidSupportSupportMediaCompat2600Alpha1Library
:prepareComAndroidSupportSupportV42600Alpha1Library
:prepareComAndroidSupportSupportVectorDrawable2600Alpha1Library
:prepareComAndroidSupportTransition2600Alpha1Library
:prepareComGoogleAndroidGmsPlayServicesBase1104Library
:prepareComGoogleAndroidGmsPlayServicesBasement1104Library
:prepareComGoogleAndroidGmsPlayServicesGcm1104Library
:prepareComGoogleAndroidGmsPlayServicesIid1104Library
:prepareComGoogleAndroidGmsPlayServicesLocation1104Library
:prepareComGoogleAndroidGmsPlayServicesTasks1104Library
:prepareComOnesignalOneSignal362Library
:prepareComRomandanylykPageindicatorview020Library
:prepareCommon20171719DevReleaseLibrary
:prepareData20171719DevReleaseLibrary
:prepareList20171719DevReleaseLibrary
:preparePrimitives20171719DevReleaseLibrary
:prepareWidgetsReleaseLibrary
:prepareF0F1F2F3F4F5F6F7F8DebugDependencies
:compileF0F1F2F3F4F5F6F7F8DebugAidl
:compileF0F1F2F3F4F5F6F7F8DebugRenderscript
:generateF0F1F2F3F4F5F6F7F8DebugBuildConfig
:cleanLocalAarFiles
:ensureMetadataOutDir
:collectAllJars
:setProperties
:generateTypescriptDefinitions SKIPPED
:copyTypings SKIPPED
:asbg:generateInterfaceNamesList
:asbg:traverseJsFiles
:asbg:runAstParser
Running full build
finished with reading lines with js files
:asbg:generateBindings
:generateF0F1F2F3F4F5F6F7F8DebugResValues
:generateF0F1F2F3F4F5F6F7F8DebugResources
:mergeF0F1F2F3F4F5F6F7F8DebugResources
:processF0F1F2F3F4F5F6F7F8DebugManifest
[com.onesignal:OneSignal:3.6.2] C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\build\intermediates\exploded-aar\com.onesignal\OneSignal\3.6.2\AndroidManifest.xml:52:13-48 Error:
Attribute meta-data#onesignal_app_id#value at [com.onesignal:OneSignal:3.6.2] AndroidManifest.xml:52:13-48 requires a placeholder substitution but no value for <onesignal_app_id> is provided.
[com.onesignal:OneSignal:3.6.2] C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\build\intermediates\exploded-aar\com.onesignal\OneSignal\3.6.2\AndroidManifest.xml:56:13-67 Error:
Attribute meta-data#onesignal_google_project_number#value at [com.onesignal:OneSignal:3.6.2] AndroidManifest.xml:56:13-67 requires a placeholder substitution but no value for <onesignal_google_project_number> is provided.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F0\AndroidManifest.xml Error:
Attribute meta-data#onesignal_app_id#value at AndroidManifest.xml requires a placeholder substitution but no value for <onesignal_app_id> is provided.
C:\Users\Rajdeep\Documents\aqua-app\src\platforms\android\src\F0\AndroidManifest.xml Error:
Attribute meta-data#onesignal_google_project_number#value at AndroidManifest.xml requires a placeholder substitution but no value for <onesignal_google_project_number> is provided.
> Building 67% > :processF0F1F2F3F4F5F6F7F8DebugManifest
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
:processF0F1F2F3F4F5F6F7F8DebugManifest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processF0F1F2F3F4F5F6F7F8DebugManifest'.
> Manifest merger failed with multiple errors, see logs
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1 mins 7.429 secs
Unable to apply changes on device: emulator-5554. Error is: Command gradlew.bat failed with exit code 1.
Please help me solve this.
Thank you..
There are two errors in your Gradle build:
Attribute meta-data#onesignal_app_id#value at [com.onesignal:OneSignal:3.6.2] AndroidManifest.xml:52:13-48 requires a placeholder substitution but no value for <onesignal_app_id> is provided.
Attribute meta-data#onesignal_google_project_number#value at AndroidManifest.xml requires a placeholder substitution but no value for <onesignal_google_project_number> is provided.
According to the onesignal documentation, you need to provide both of these in order to use the plugin - https://documentation.onesignal.com/docs/android-sdk-setup
So, you could include, in your app/App_Resources/Android/app.gradle the following:
android {
defaultConfig {
manifestPlaceholders = [onesignal_app_id: "PUT YOUR ONESIGNAL APP ID HERE",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
}
}

Resources