I have an ionic 3 app that we have been using in production. I just did a new clone of the repo and tried to build the android version. It fails with:
com/ionicframework/common/IonicCordovaCommon.java:61: error: cannot find symbol
assetManager = cordova.getContext().getAssets();
^
symbol: method getContext()
location: variable cordova of type CordovaInterface
src/com/ionicframework/common/IonicCordovaCommon.java:116: error: cannot find symbol
Context c = cordova.getContext();
^
symbol: method getContext()
I did not change anything in the code base -- and it was working well a few hours ago before the clone of the repo.
This is due to a plugin. The package.json had the following spec:
"cordova-plugin-ionic": "^5.3.0",
Turns out the latest version of the plugin is not compatible. To fix, just change to
"cordova-plugin-ionic": "5.3.0",
That is stick to 5.3.0 -- and not later version.
Remove plugin:
cordova plugin rm cordova-plugin-ionic
Add older version
cordova plugin rm cordova-plugin-ionic#5.3.0
This fails with
cordova plugin add cordova-plugin-ionic#5.3.0
Variable(s) missing (use: --variable APP_ID=value --variable CHANNEL_NAME=value).
To fix remove platform android and add again.
cordova platform rm android; cordova platform add android#6.4
Once done, the build using
cordova build android
and see it succeed.
Related
in order to use a new plugin, I had to update my cordova version to 9.0.0, and I also updated my android version to 28.
My problem is now I can't compile my project because of the cordova plugin "localnotification" (https://github.com/katzer/cordova-plugin-local-notifications).
I have a bunch of errors (maybe 150/200) related to android support library v4, like :
error: package android.support.v4.content does not exist
or
cannot find symbol public class AssetProvider extends FileProvider {
^
Because I updgraded android, I had to migrate to androidX too. I did it by adding this in gradle.properties :
android.enableJetifier=true
android.useAndroidX=true
But now I'm unable to compile my app without all these errors above. I found something saying that we should add these lines in the .gradle of the plugin :
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
I did it without success.
Any other ideas ?
Thanks in advance !
Error: Execution failed for task ':processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.+.
i want ionic cordova plugin cordova-plugin-fcm-with-dependecy-updated for notification but build is crash after installed this plugin if i remove this plugin then my app is working
i try to use fcm plugin with android 8.0.0 with cordova-plugin-googleplus 7.0.0 and i try with android 7.4.1 and 6.4.0 with cordova-plugin-googleplus 5.2.1
try this!..
step 1 ionic cordova platform rm android
step 2 go to /plugins/cordova-plugin-fcm-with-dependecy-updated/src/android/FCMPlugin.gradle
change like this
buildscript {
repositories {
mavenCentral()
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
classpath 'com.google.gms:google-services:3.1.+'
}
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
compile 'com.google.firebase:firebase-core:11.4.2'
}
// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
step 3 ionic cordova platform add android
step 4 Goto /platforms/android/project.properties
Change like the numbers into 11.4.2
cordova.system.library.3=com.google.firebase:firebase-core:11.4.2
cordova.system.library.4=com.google.firebase:firebase-messaging:11.4.2
cordova.system.library.7=com.google.android.gms:play-services-auth:11.4.2
cordova.system.library.8=com.google.android.gms:play-services-identity:11.4.2
demo project.properties file
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-26
android.library.reference.1=CordovaLib
cordova.gradle.include.1=cordova-plugin-badge/mobile-badge.gradle
cordova.system.library.2=com.facebook.android:facebook-android-sdk:4.25.0
cordova.system.library.3=com.google.firebase:firebase-core:11.4.2
cordova.system.library.4=com.google.firebase:firebase-messaging:11.4.2
cordova.gradle.include.2=cordova-plugin-fcm-with-dependecy-updated/mobile-FCMPlugin.gradle
cordova.system.library.6=com.android.support:appcompat-v7:25.+
cordova.system.library.7=com.google.android.gms:play-services-auth:11.4.2
cordova.system.library.8=com.google.android.gms:play-services-identity:11.4.2
cordova.gradle.include.3=cordova-plugin-local-notification/mobile-localnotification.gradle
cordova.gradle.include.4=cordova-plugin-telerik-imagepicker/mobile-ignorelinterrors.gradle
cordova.gradle.include.5=cordova-plugin-telerik-imagepicker/mobile-androidtarget.gradle
cordova.gradle.include.6=phonegap-plugin-barcodescanner/mobile-barcodescanner.gradle
cordova.system.library.11=com.android.support:support-v4:27.+
cordova.gradle.include.7=twitter-connect-plugin/mobile-twitter.gradle
cordova.system.library.12=com.squareup.okhttp3:okhttp:3.12.0
step 5 ionic cordova build android
Note :: Don't forgot to add google-services.json file in root directory, main_project/google-services.json
We have the same issue and yesterday we solve this problem with this answer:
Answer:1
This is due to the firebase updates on April 05. Here https://firebase.google.com/support/release-notes/android#update_-_april_02_2019, I found the last working versions and adjusted my project.properties accordingly like so
cordova.system.library.4=com.google.firebase:firebase-core:16.0.8
cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.6=com.google.firebase:firebase-config:16.4.1
cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4
Here all dependencies are locked to the specific version (Update - April 02, 2019) instead of +, which would get you the latest version thus breaking the build process.
Now I can build successfully! I hope it helps!
Ref: page
Answer: 2
A wonderful person opened a pull request 31 in the cordova-firebase-plugin official repo and it works.
Steps I did:
1 - Remove cordova-firebase-plugin with ionic cordova plugin remove cordova-
firebase-plugin
2 - Install: ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
3 - rm -rf node_modules/ plugins/ platforms/android package-lock.json
4 - ionic cordova platform add android && npm install
5 - In my case, I also use a firebase js library in an old version because the newest ones are not working for me. With that library I always need to reinstall it manually after all the previous steps, so also I did: npm install firebase#4.12.1.
And now it’s working.
ref: Page
I'm a Korean who develops with Cordova
I solved as below.
cordova-plugin-admob-free and
Library conflict with cordova-plugin-fcm-with-dependecy-updated.
I changed only the ads version and ran it as shown below.
I am not sure if the content will be delivered using Google Translate.
enter image description here
/platforms/android/project.properties
cordova.system.library.1=com.google.firebase:firebase-core:16.0.9
cordova.system.library.2=com.google.firebase:firebase-messaging:18.0.0
cordova.gradle.include.1=cordova-plugin-fcm-with-dependecy-updated/helloworld-FCMPlugin.gradle
cordova.system.library.3=com.google.android.gms:play-services-base:11.0.4
cordova.system.library.4=com.google.android.gms:play-services-ads:17.0.0
This is an Ionic Cordova project. I haven't touched in in a while but I came back to it now and when I run
ionic cordova build android
I get the following error:
Minimum supported Gradle version is 4.4. Current version is 4.1. If using
the gradle wrapper, try editing the distributionUrl in
C:\projects\ghost\gradle\wrapper\gradle-wrapper.properties to gradle-4.4-
all.zip
So I did that and had my gradle.properties file looking like this:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-
all.zip
But the build still fails and the properties file reverts to have 4.1 listed in it.
I have Gradle 4.9 installed and added to the path but that didn't work either.
Windows 10 Machine.
UPDATE:
I tried changing the cordova build script in GradleBuilder.js where it referenced gradle 4.1 to have gradle-4.4-all instead but the result was the same.
Thanks for any input.
Steve
upgrade all your Sdk and do:
ionic cordova platform rm android
ionic cordova platform add android#7.1.1 or latest
this will allow u to correct the gradle problem since it will update the gradle automatic
I am trying to install Facebook Plugin using the Automatic Installation section mentioned here https://github.com/phonegap/phonegap-facebook-plugin for phonegap using this command
phonegap plugin add C:\Softwares\phonegap-facebook-plugin --variable APP_ID="240818432XXXXXX" --variable APP_NAME="MyAPPNAME"
and i get thie serror
[phonegap] adding the plugin: C:\Softwares\phone
[Error: Variable(s) missing: APP_ID, APP_NAME]
[error] Variable(s) missing: APP_ID, APP_NAME
So i saw this question and followed it Cordova Facebook plugin : missing variables APP_ID, APP_NAME
I installed plugman using nodejs and run the command below
plugman -d install --platform android --project C:\Users\Documents\myproject
--plugin C:\Softwares\phonegap-facebook-plugin --variable APP_ID="240818432XXXXXX"
--variable APP_NAME="MyAPPNAME"
and i get this error :
Installing "com.phonegap.plugins.facebookconnect" for android
cordova version check failed ("C:\Users\Documents\myproject\cordova\version")
, continuing anyways.
Install start for "com.phonegap.plugins.facebookconnect" on android.
Beginning processing of action stack for android project...
Error during processing of action! Attempting to revert...
Failed to install 'com.phonegap.plugins.facebookconnect':Error: Uh oh!
"C:\Users\Documents\myproject\res\values\facebookconnect.xml" already exists!
I am not sure if i am in the right way on installing facebookplugin for phonegap. I just followed the documentation in phonegap and this is what i get.
I am using windows7 64 bit.
Any guidance will be really appreciated.
Thanks
The project path is wrong. It should point to \myproject\platforms\android.
You need to run phonegap build android first to build this.
plugman -d install --platform android --project C:\Users\Documents\myproject
--plugin C:\Softwares\phonegap-facebook-plugin
--variable APP_ID="240818432XXXXXX" --variable APP_NAME="MyAPPNAME"
When I add a plugin to a 3.0.0 phonegap project with an android platform, I have an error eventhough a bunch of files for the plugin are added. In addition to that error when I add it, the Android manifest never gets updated with the right authorizations.
$ cordova plugin ls
No plugins added. 'Use cordova plugin add <plugin>'.
$ sudo cordova plugin add "http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git"
{ [Error: ENOENT, no such file or directory '/tmp/plugman-tmp1375200648427/*/plugin.xml']
errno: 34,
code: 'ENOENT',
path: '/tmp/plugman-tmp1375200648427/*/plugin.xml',
syscall: 'open' }
$ cordova plugin ls
[ 'org.apache.cordova.core.media-capture' ]
I was having the same problem with the Connection plugin. Once I changed from "cordova plugin add" to "phonegap local plugin add", it worked fine.
$ phonegap local plugin add http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git
I had the same problem, after some debugging and testing I finally solved the problem:
Open
C:\Users\<user>\AppData\Roaming\npm\node_modules\cordova\node_modules\plugman\src\util\plugins.js.
Find var cmd = util.format('git clone "%s" "%s"', plugin_git_url,
path.basename(tmp_dir)); (line 42 ATM)
Replace it with var cmd = util.format('git clone "%s"
"%s"', plugin_git_url, tmp_dir);.
This will make git clone clone to the absolute tmp path instead of the relative.
I received a similar error. I resolved the issue by removing the media-capture plugin, installing the file plugin, then reinstalling the media-capture plugin
cordova plugin rm org.apache.cordova.media-capture
cordova plugin add org.apache.cordova.file
cordova plugin add org.apache.cordova.media-capture
Maybe media-capture is dependent on the file plugin.
I was also facing the same error :
Suppose if you want to add camera plugin then instead of giving:
cordova plugin add cordova-plugin-camera
use
phonegap plugin add cordova-plugin-camera
and then it will work fine
It turns out i had something really strange with my proxy. Possibly some data compression on the fly which made the data corrupt. Tethering from the phone solved the issue, after completely uninstalling cordova.