FabricPlugin
FabricPlugin copied to clipboard
Crashlytics was applied to a project without an Android plugin
I am working on a cordova app that uses cordova-fabric-plugin.
We are recently having this error when building the app with Gradle, and we are not able to identify the cause:
Failed to apply plugin [id 'io.fabric'] Error:(66, 0) Crashlytics was applied to a project without an Android plugin. Please make sure the Crashlytics plugin is applied after the appropriate Android plugin for your project.
Gradle build is generated from a package.json file which defines the dependencies of the project. Two of these dependencies are:
- cordova-android: 7.0.0
- cordova-fabric-plugin: ^1.1.10
This is the generated build.gradle file that causes the error:
Is this a bug in the plugin? Can someone help me here, please?
Thank you. Kind regards.
Looks like this is an incompatibility of the plugin with cordova-android platform 7.0.0.
After updating Android platform to version 6.4.0:
ionic cordova platform rm android
ionic cordova platform add [email protected]
Generated Gradle script builds OK.
For me, you can leave this issue opened. It will need to work with newest version of cordova (cordova 8).
I am leaving this issue opened per @ElodieC request.
Looks like issue #119 is exactly the same.
Hi, Did you find a solution for this ? I'm on cordova 8 and cannot downgrade. Thanks
Fix for this issue:
in hooks/lib/utilities.js
replace getBuildGradlePath
function with:
function getBuildGradlePath() {
var target = path.join("platforms", "android", "app", "build.gradle");
if (fs.existsSync(target)) {
return target;
}
return path.join("platforms", "android", "build.gradle");
};
This triggers a new error because in the src/android/build-extras.gradle
the config.xml is referenced in the wrong location, fixing it by pointing to the correct folder makes it work but breaks backwards compatibility so if anyone knows a fix that maintains backwards compatibility please comment.
Simple (not-backwards compatible) fix:
Replace
def config = file("res/xml/config.xml").getText()
with
def config = file("src/main/res/xml/config.xml").getText()
@chancezeus I tried your solution which built fine, however I would get an error message Failed to send analytics.
Did you manage to get it working all the way?
@814k31 I just checked and for me both sending a custom event and a crash report both succeed so I think this error is either not related to this specific plugin or it is configured incorrectly (wrong key/secret for example).
Interesting I've had it working fine with cordova-android 6.4 for ages so I may sit on it for a little before trying again
Thanks
have the same problem and the suggested edits from @chancezeus don't seem to work for me.
@viking2917 The edits have to be done in the plugins/... folder before adding the platform, otherwise the gradle change also has to be applied in the copy created by cordova inside the android platform folder
aha. thank you @chancezeus . Let me give that a go.
@chancezeus OK that did it.
ionic cordova platform rm android
cordova plugin add cordova-fabric-plugin --variable FABRIC_API_KEY=<yourkey> --variable FABRIC_API_SECRET=<yourkey>
(your edits done to the files under the plugin folder per the above)
ionic cordova platform add android
And that did the trick. Thank you so much!
I still seem to be getting this error, even with the steps above.
A problem occurred evaluating root project 'android'.
Failed to apply plugin [id 'io.fabric'] Crashlytics was applied to a project without an Android plugin. Please make sure the Crashlytics plugin is applied after the appropriate Android plugin for your project.
I assume the changes to hooks/lib/utilities.js are in plugins/cordova-fabric-plugin/hooks/lib/utilities.js?
Is this error message referring to a Cordova plugin or a Fabric plugin or something else. Thanks!
@mnowak-umich The error is in regard to the Cordova Fabric Plugin (the plugin whose github page we are on), I don't think I have any other plugins that are related to this issue.
I took the following steps. removed the android platform. per the above, edited the two files
plugins/cordova-fabric-plugin/hooks/lib/utilities.js plugins/cordova-fabric-plugin/src/android/build-extras.gradle
the added the android platform back, and then it worked for me. Hope that helps.
For those looking for a quick fix for now, I just created a quick fork with my fixes applied. I tested a quick build with android 7.0.0 and there seem to be no problems. The fix should remain backwards compatible and thus should be pullable as is without any issues. Pull request (#122) has been submitted but for now you can install my version using:
[ionic] cordova plugin add https://github.com/chancezeus/FabricPlugin.git --variable FABRIC_API_KEY={YOUR API KEY} --variable FABRIC_API_SECRET={YOUR API SECRET}
Hope it helps those in need :relieved:
Thanks I will give it a try today!
-- Mike Nowak Center for Health Communications Research 📬 North Campus Research Complex 2800 Plymouth Road, Building 16 The University of Michigan 💻 http://chcr.umich.eduhttp://chcr.umich.edu/ From: Mark van Beek [email protected] Reply-To: sarriaroman/FabricPlugin [email protected] Date: Wednesday, February 7, 2018 at 6:28 PM To: sarriaroman/FabricPlugin [email protected] Cc: mnowak-umich [email protected], Mention [email protected] Subject: Re: [sarriaroman/FabricPlugin] Crashlytics was applied to a project without an Android plugin (#120)
For those looking for a quick fix for now, I just created a quick fork with my fixes applied. I tested a quick build with android 7.0.0 and there seem to be no problems. The fix should remain backwards compatible and thus should be pullable as is without any issues. Pull request (#122https://github.com/sarriaroman/FabricPlugin/pull/122) has been submitted but for now you can install my version using: cordova plugin add https://github.com/chancezeus/FabricPlugin.git
Hope it helps those in need 😌
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/sarriaroman/FabricPlugin/issues/120#issuecomment-363947086, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABge_Io7qldBHdj_CzLSvcNx53EN83vzks5tSjF-gaJpZM4RctVC.
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues
I got this error:
Failed to fetch plugin https://github.com/chancezeus/FabricPlugin.git via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. Failed to get absolute path to installed module (node:34859) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
-- Mike Nowak Center for Health Communications Research 📬 North Campus Research Complex 2800 Plymouth Road, Building 16 The University of Michigan 💻 http://chcr.umich.edu/
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues
@chancezeus OK that did it.
ionic cordova platform rm android cordova plugin add cordova-fabric-plugin --variable FABRIC_API_KEY=<yourkey> --variable FABRIC_API_SECRET=<yourkey> (your edits done to the files under the plugin folder per the above) ionic cordova platform add android
And that did the trick. Thank you so much!
Yes its working thank you so much