PhoneGap build fails after plugin install - android

I installed this phonegap plugin: https://github.com/cranberrygame/phonegap-plugin-ad-admob
cordova plugin add com.cranberrygame.phonegap.plugin.ad.admob
but now my build now fails even after I remove it.
export ANDROID_HOME=/var/lib/android-sdk-linux
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
phonegap build android
here is the result:
http://pastebin.com/ZdJw3izm
this happened after installing a different plugin but was fixed after installing some extras for android like the billing library ect. but they are still installed...

I have fixed this myself by creating a new project and copying the code over, but im not sure how to mark this question as answered...

Related

Cordova Could not find an installed version of Gradle either in Android Studio, or on your system to install the gradle wrapper

Long story short, I've tried all sorts of solutions SO and other sites have proposed, and I'm certain none of them handle my scenario. I'm using Cordova to build my apps. I recently reinstalled Cordova, and apps stopped building.
Yes, I've installed and included gradle in my path (I'm on Windows)
I've verified and gradle is installed (gradle -v) from command prompt
When I open the project directly from Android Studio, it finds gradle and builds successfully
When I use cordova to run it from the cmd, I get the above error
Funny enough, when I delete downloaded files from C:\user\.gradle as some SO and GitHub solutions suggest, it downloads gradle, and after completing the download, still tells me gradle couldn't be foound
I've upgraded Node, NPM and Cordova to their latest versions. If it's of any help, I'm building on Ionic and both Ionic and Angular have been equally upgraded to their latest versions. Ionic serve and every other related command works. Here's the command that triggers the error:
ionic cordova run android
You should ensure the path of the gradle installation is exactly the same path you are setting in your environment/path variable.
That solved it for me

Gradle version to use with Android/Cordova CLI

I currently use Cordova CLI on Windows to build hybrid Android apps. I am in the process of moving my development mover to a headless Ubuntu server. Getting java, NVM, Node, Android SDK and Cordova CLI installed on Ubuntu has not been a problem. Having done so and created the customary Cordova hello world project,
cordova create hello com.example.hello HelloWorld
I proceeded to add the Android platform
cordova plaform add android
and then attempted to build
cordova build android
at which point I was told
Error: Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
Installing Gradle by following the instructions given here - I am NOT installing Android Studio and am working on a headless Ubuntu machine so automatic Gradle installation is not an option - is not a problem. However, it is not clear to me which version of Gradle I should install.
I do not want to break my current Cordova project so I am trying to replicate the current Windows/Cordova CLI setup as closely as I can
Node 8.9.2
Java 8
Gradle ???
Dipping inside the gradle-wrapper.properties file in my existing project I find
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
I have noted that when I compile the project at present there are some ominous warnings about features to be removed from future versions of Gradle that are shown. I could experiment with using gradle-2.10 but it is not entirely clearr to me that it would indeed be the right version. Hopefully, someone here will be able to point me in the right direction.
First, clean up the project
cordova clean android
Then, force the cordova to use the distribution url with the version you want, in this case: gradle-6.3
export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL=https\\://services.gradle.org/distributions/gradle-6.3-all.zip
Then, build your application.
cordova build android --release

Can't add downloaded plugin to Cordova/Phonegap project

How can I get a plugin to work by installing it NOT from the repository.
Each plugin I try to install using phonegap plugin add <<git repository>> always results in different errors, because windows + npm just doesn't want to work for me...
This is the plugin I need: https://github.com/VersoSolutions/CordovaClipboard
My steps:
Download Git repository
Run phonegap plugin add <<downloaded and extracted directory>>
Remove and add android platform (yes it says that it installed the plugin)
Start Phonegap Developer app
But cordova.plugins.clipboard is still undefined. Do I have to put the clipboard.js file somewhere or reference it? If so, which version?
The one in the clipboard project or the one phonegap automatically creates within the platform/android directory (it puts a "define" around it). I actually tried both, but the object was still undefined.
The clipboard plugin does not have a package.json present which is why you are getting the error. You can either add a package.json file to the plugin or you can install it with the --nofetch flag:
cordova/phonegap plugin add https://github.com/VersoSolutions/CordovaClipboard.git --nofetch
Since cordova 7.0.0 npm install is run by default when adding a new plugin which causes an error if no package.json is present. You can find the release notes for cordova 7.0.0 here.

Adding Dialogs Plugin to phonegap project prevents deviceReady from Firing

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 .

phonegap/ Cordova error: [RangeError: Maximum call stack size exceeded]

I am trying to create a phonegap / cordova app using the 3.1.0 version.
Created my app with the command:
cordova create hello com.example.hello HelloWorld
And after running this command:
cordova platform add android
to add android platform, i am getting:
[RangeError: Maximum call stack size exceeded]
Any idea what could be the issue?, previously i created another app, but same error was occurring when adding camera plugin.
I faced the same issue, but I was actually issuing the command in wrong directory, so firstly I changed the directory to Hello then issued the command.
So, I have directory structure as,
---Cordova
---Hello
and I was actually issuing the command by being at Cordova folder. After that I changed the folder to Hello then executed this cordova platform add android and it worked.
Please check once
be sure you are located in the created directory (Hello, I guess), the same level with .cordova
cd Hello
For anyone coming to this question after July 2013 (when Cordova 3.0.0 was released), there is another reason for this problem.
If you created a Cordova project on a computer with Cordova 3.x and you are trying to work with it on a computer that still has the old 2.x version, you will get this error because of how the project structure changed between the versions.
Upgrading Cordova to the newest version using npm install -g cordova will fix the problem.

Categories

Resources