I wrote a Flutter plugin that find the absolute path for a file on an Android system using the PickiT library. The plugin, called Flutter absolute path, has the dependency of the PickiT library added on the plugin build.gradle:
dependencies {
implementation 'com.github.HBiSoft:PickiT:2.0.5'
}
But when I add this plugin to my app and I try to compile it, I receive this error:
<APP_PATH>/GeneratedPluginRegistrant.java:34: error: cannot access PickiTCallbacks
flutterEngine.getPlugins().add(new net.altermundi.flutter_absolute_path.FlutterAbsolutePathPlugin());
^
class file for com.hbisoft.pickit.PickiTCallbacks not found
The only way that I found to make my plugin working is to add the library to my project on the app/build.gradle dependencies also.
How can I make the plugin Android dependency implicit on the whole project without adding it?
Related
I need to use a react native library called #ihealth/ihealthlibrary-react-native
I added it to my project, but on build I get an error Could not find no.nordicsemi.android:dfu:1.6.1
This package version seems to be no longer available, so I would like to override the version in my react native app.
I added the following in MyProject/android/app/build.gradle
dependencies {
implementation("com.ihealth.ihealthlibrary:iHealthLibrary:1.5.1") {
exclude group:'no.nordicsemi.android:dfu:1.6.1'
}
implementation("no.nordicsemi.android:dfu:1.8.0")
}
I then get this error: Could not find com.ihealth.ihealthlibrary:iHealthLibrary:1.5.1.
Basically I can't figure out what's the correct package name and version to put in my config.
Where can I find this ?
This lib is really outdated. Go into the libraries build.gradle file and replace this implementation 'no.nordicsemi.android:dfu:1.6.1'
with: implementation 'no.nordicsemi.android:dfu:1.8.0'
then create a patch: yarn patch-package #ihealth/ihealthlibrary-react-native
I am working on an Android plugin for a Flutter project. For this plugin, I need to reference a compileOnly dependency.
It seems that I have to add the compileOnly dependency in two Gradle files.
plugin build.gradle (to have code completion working)
app build.gradle (otherwise the building of the app fails with a gradle error)
/Users/0000000-android_battery_status-dalosy/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java:19: error: cannot access EMDKManager
flutterEngine.getPlugins().add(new com.dalosy.android_battery_status.AndroidBatteryStatusPlugin());
^
class file for com.symbol.emdk.EMDKManager not found
Is there a way to avoid the second one?
It feels bad to require the users of my plugin to add a compileOnly dependency in their Android project.
I am completely new to android studio and android development. I followed the instructions from the project page inside the app center. When I try to apply the first step:
Add the SDK to the project
In your app/build.gradle add the following lines:
dependencies {
def appCenterSdkVersion = '4.1.0'
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
}
I get the following error in android studio:
Could not find method implementation() for arguments [com.microsoft.appcenter:appcenter-analytics:4.1.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I found this all depends on gradle and it's version but I couldn'd find a version that makes the error disappear
Current gradle versions
I figured that I did put the the dependendcies into the wrong build.gradle file (project instead of module). After moving the lines to the right file and forcing a gradle sync everything works.
I have a newer android project that's using the 2.3 gradle plugin in Android Studio. I am trying to include an older android library that uses the 2.0.+ gradle plugin.
If I just compile the library by itself, it compiles successfully. When I include ':library' and put this library in the main project's dependencies{ compile project(':library') }, I get the following error on Gradle Sync:
Error:(50, 0) Could not get unknown property 'assembleDebug' for object of type com.android.build.gradle.LibraryExtension.
The library's build.gradle file has an assembleDebug block, and from this issue: https://code.google.com/p/android/issues/detail?id=219732#c21, it seems to be related to some change in the 2.2 gradle plugin.
I'm not the author of the library, so I don't to change anything in the library itself, just use it. Is it possible to include this older library in the newer project without having to modify the library's build.gradle file to work with the newer gradle version?
I am try to write a IntelliJ plugin that will automatically add dependency to android build.gradle file.
dependencies {
compile com.XXX.XX }
For example when we add Crashlytics plugin in android studio.
its adds a dependency in build.gradle file. I need the exact solution for my plugin. I refer the below link
How to add gradle dependency automatically
Kindly give more idea to implement this.