Previously i have used phonegap 1.1.0 jar, 1.1.0 js and plugins like childbrowser and system notification.It was working fine.I have a problem for blackscreen application(Android: BlackScreen in Application)
so I have used cordova-1.7.0.jar and cordova-1.7.0.js in android phonegap app.But I am getting error in the plugin.
Error
at Compile time
context cannot loaded,many classes cant imported.
The old plugins are incompatable with the current version, best to reinstall the plugins from scratch.
see:
http://simonmacdonald.blogspot.co.uk/2012/04/migrating-your-phonegap-plugins-to.html
Related
I added capacitor via the quasar framework. I didn't add any plugin at first and everything worked perfectly. Then I updgraded to capacitor v3. I followed the guide and my app worked also without any problems. Then I added the geolocation plugin to capacitor. It works as expected in the browser, but when I try it on my native android device it gives me this error:
"Geolocation" plugin is not implemented on android
It looks like I didn't install the plugin, but as I said, it works in the browser.
Ok fixed it, by checking both package.json files (also the one in /src-capacitor). I used capacitor 3 in my web project but capacitor 2 in my capacitor project. I wanted to use v3 so I tried to access the plugin in the way of capacitor v3 which did not work.
This is because Capacitor changes the underlying Gradle files but Android Studio doesn't know.
To fix this, go to Android studio click File -> Sync Project with Gradle Files
I am having a build issue with a Cordova project that I have inherited specifically the error raised is: -
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
:app:processDebugResourcesC:\Users\andy.gradle\caches\transforms-1\files-1.1\support-compat-28.0.0.aar\96270291fb4c7e49ddab8d4d1a4f36f7\res\values\values.xml:133:5-70: AAPT: error: resource android:attr/fontVariationSettings not found.
I have another project which builds successfully and the difference between the two projects appears to be the platforms\android\project.settings file, if I manually change the setting my project builds. However as this file appears to be re-created every time I run cordova prepare android this is not an ideal situation, the setting in question is: -
cordova.system.library.1=com.android.support:support-v4:+
if I change this to: -
cordova.system.library.1=com.android.support:support-v4:24.1.1+
my build is successful!
So my question is what impacts this setting, as I feel I need to understand the reasoning behind the differing value as other than the working project having more dependencies the non-working project contains the same references but has one additional dependency this being: -
cordova-plugin-file-opener2
I do not have SDK version 28 installed, I can see the logic behind the error and I would assume installing version 28 may resolve the issue but I would like to understand why one project creates the settings with one version number and the second project is created with a differing one?
In Cordova projects, the versions of native libraries pulled into the Android build via Gradle are controlled directly by the Cordova plugins you have installed in your project.
The Gradle config is dynamically generated by Cordova, so each time you run cordova prepare android, the build.gradle file is regenerated.
In this case, the library dependency is the Android Support Library (com.android.support).
cordova-plugin-file-opener2 specifies version + which will pull in the very latest version, which is currently v28.0.0 as can be seen on the releases page.
However, if another plugin in your project specifies a different version, this will lead to problems and often build failures due to version conflicts.
In a native Android project, the build.gradle file is under your direct control, so you'd never have these problems.
One solution is to install the cordova-android-support-gradle-release plugin into your project.
This plugin overrides the versions of the Android Support Library specified by other plugins, enabling you to align the versions and so fix the build problems.
For example, in your case you can run:
cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=24.1.1
This will install the plugin and override the versions specified by other plugins to ensure v24.1.1 of the Support Library is included in your project.
One consideration is that v24 is quite old, so you may want to try a newer version, e.g.:
cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=27.+
Just to add some detail to my solution just in case it helps anybody else in the future!
DaveAlden added a very helpful description above of what is happening which is worth reading through as it is very difficult to get a clear concise explanation of what is or should be happening with these technologies.
My project did indeed already have the cordova-android-support-gradle-release plugin installed and it was set to 27.+ however I followed the following process and everything then started working: -
Updated my Android SDK software to the latest
Updated Cordova from version 8.0.0 to 8.1.2
Removed plugin cordova plugin add cordova-android-support-gradle-release
Added plugin back in cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=27
I then retried the build and everything then started working.
UPDATE:
I came to deploy my app again today and I have got the same error again, to resolve it I ran: -
cordova plugin remove cordova-android-support-gradle-release
cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=27.+
and it then builds successfully, I have no idea why this occurs but it is something to do with the \platforms\android\project.properties file not being setup correctly as when it builds successfully this file contains the following line: -
cordova.gradle.include.1=cordova-android-support-gradle-release/portal-cordova-android-support-gradle-release.gradle
I'm sure somebody with a clearer understanding of the build process could add some clarity!
Whenever I start a new React Native project and open the android part in the android studio. I get a message to update gradle plugin and gradle .
And updating them leads to erroneous imports which were previously working fine.
So, is there any limitation on gradle plugin or gradle for react-native android projects ?
Im having trouble building my app through the build process of Telerik Appbuilder. We are using a modified version of the multi imagepicker plugin wich has a reference to the android-support-v4.jar in the plugin.xml, like so
<source-file src="src/android/Library/libs/android-support-v4.jar" target-dir="libs"/>
When I try to create a build via de Telerik AppBuilder option it gives the following error and doesnt complete the build.
android-support-v4.jar" already exists
When I remove the reference from the plugin.xml and try create a build again, it finishes the build without any errors but then the plugin does not work.
I've already tried to use the plugin in a cordova (5.4.1) test project and have build it via CLI commands. With cordova I can successfully build a test project with the plugin and the reference to the android support library in place. The test app deploys succesfully to my android device via cordova run android The plugin and its modifications are fully functional in the test project.
FYI => If I remove the android support library reference in the plugin.xml in the cordova test project the entire project does not build. I get loads of compiling errors.
Does anyone has had the same experience or has an indication of what causes the error when I build via the Telerik Appbuilder tools?
The error for conflicting android-support-v4.jar is caused by having incompatible plugins in your project. In order to use the latest available android support v4 library you should remove the jar from your plugin and replace the lib-file element of your plugin.xml with <framework src="com.android.support:support-v4:+" />.
Additionally, if you have other plugins which install their own version of the library, you'll have to either upgrade them to their latest version (which hopefully will have been fixed) or make the same modification in them. For more information on this issue you can refer to the following AppBuilder forum thread: http://www.telerik.com/forums/breaking-change-introduces-build-failure-for-android
I started using phonegap but as a beginner i ran into many problems.
one of the latest is problem with adding plugins
I added plugin of dialogs
org.apache.cordova.dialogs
with command line tool and it added successfully . but after running application in android emulator it never fire deviceReady Event. before adding plugin it was OK.
as a note I should say I installed older versions of plugin but they didn't work either !
Well I found the answer , I was building my project with phonegap but installed cordova plugins , I create a new project with command
cordova create project [folder name] [namespace "like com.example.appname"]
[project name]
and it worked correctly after that and I installed plugins as usual .