build failed when push notification plug in added to project on mac - ios

I am using PhoneGap to build applications.
Application runs properly on emulator but when push notification plug in is added to project it gives build errors.
I searched this issue...initially it was found to be a common issue to many people...tried all solutions...but still the same build errors.
here is the plug in
sudo cordova plugin add phonegap-plugin-push
one of the solution said try out with 1.2.3 version of push notification i.e
sudo cordova plugin add phonegap-plugin-push#1.2.3
There were no errors using this version but then it is older version want a solution with the latest version.
The latest is working on windows machine but not on MAC.
Here is the detailed error when used latest version
ANDROID_HOME=/Users/bunty/Library/android-sdk-macosx
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find any version that matches com.android.support:support-v13:23+.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/support-v13/maven-metadata.xml
https://repo1.maven.org/maven2/com/android/support/support-v13/
Required by:
:android:unspecified
> Could not find any version that matches com.google.android.gms:play-services-gcm:+.
Searched in the following locations:
https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/maven-metadata.xml
https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/
Required by:
:android:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 37.885 secs
Error: Error code 1 for command: /Users/bunty/Documents/ParsianaApp/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/bunty/Documents/ParsianaApp/platforms/android/build.gradle,-PcdvBuildArch=arm,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
Can anyone help on this ?

If you read the install guide
You will need to ensure that you have installed the following items
through the Android SDK Manager:
Android Support Library version 23 or greater
Android Support Repository version 20 or greater
Google Play Services version 27 or greater
Google Repository version 22 or greater
You can do it manually or using this command:
android update sdk --no-ui --filter "extra"

Dont use sudo for installing. It causes permissions issues.

Related

ionic Cordova platform add iOS fails

I'm trying to run the command
ionic cordova platform add ios#6.2.0
everything is updated, my versions are:
ionic - 6.17.1
npm - 7.21.1
node - 16.9.1
pod - 1.11.2
I have the last version of Xcode (13) just released 2 days ago. When running that command I get:
--save flag or autosave detected
Saving ios#~6.2.0 into config.xml file ...
Update IOS build setting SWIFT_OBJC_BRIDGING_HEADER to: "$(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h" for build configuration Debug
Update IOS build setting SWIFT_OBJC_BRIDGING_HEADER to: "$(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h" for build configuration Release
Update IOS build setting ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to: YES for build configuration Debug
Use Swift language version 5
Update IOS build setting SWIFT_OPTIMIZATION_LEVEL to: -Onone for build configuration Debug
Update IOS build setting ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to: YES for build configuration Release
Use Swift language version 5
[ERROR] An error occurred while running subprocess cordova.
cordova platform add ios#6.2.0 exited with exit code 1.
After reading every post I found, I included on my config.xml:
<preference name="UseSwiftLanguageVersion" value="5" />
Thinking I might had a non-supported Xcode version, I downgraded Xcode to v12.5.1, selected it on Xcode -> Preferences -> Locations, then restarted all terminals and processes, restarted the Mac, but still not working.
I tried to update CocoaPods with the commands:
pod install
pod setup
And still nothing was working so I decided to run the command
ionic cordova prepare ios
to see if I could go on anyway but got this error:
[error] Error: Cannot find module '#ionic/angular-toolkit/package.json'
Require stack:
- /usr/local/lib/node_modules/#angular/cli/node_modules/#angular-devkit/architect/node/node-modules-architect-host.js
- /usr/local/lib/node_modules/#angular/cli/node_modules/#angular-devkit/architect/node/index.js
- /usr/local/lib/node_modules/#angular/cli/models/architect-command.js
- /usr/local/lib/node_modules/#angular/cli/commands/run-impl.js
- /usr/local/lib/node_modules/#angular/cli/node_modules/#angular-devkit/schematics/tools/export-ref.js
- /usr/local/lib/node_modules/#angular/cli/node_modules/#angular-devkit/schematics/tools/index.js
- /usr/local/lib/node_modules/#angular/cli/utilities/json-schema.js
- /usr/local/lib/node_modules/#angular/cli/models/command-runner.js
- /usr/local/lib/node_modules/#angular/cli/lib/cli/index.js
- /usr/local/lib/node_modules/#angular/cli/lib/init.js
- /usr/local/lib/node_modules/#angular/cli/bin/ng
And yes, if you are wondering every time I updated or ran a command I did also deleted the platforms, plugins, node_modules and www folder, but anything is happening.
Coincidentally today I had to migrate a Cordova project to iOS 6.2 due to Apple's usual annoyance in updating hours before and leaving everything obsolete (the best in backward compatibility, it should be noted).
I'll share with you the short commands that work with cordova without digging too much:
0-) sudo npm install cordova-ios#latest
1-) sudo ionic cordova platform remove ios
2-) sudo ionic cordova platform add ios#latest // don't specify version, the last one already assumes this
3-) sudo chmod -R 777 platforms/ios // usually, I must enable read and write permissions, things on my computer but with that I ensure full permission.
4-) sudo ionic cordova build ios
5-) You open XCode again in the generated project and voila, you can compile it.
If step #1 fails you, run it 2 times (for some reason I always have to run it 2 times to get it done).
Best regards.
Well, at the end, after 15h of work and a lot of searching, it was all fixed by downgrading my Node version from 16.9.1 to 14.17.5.
I didn't know that this new Node version is not supported by Angular jet, but I found out, and you can too by just running the command
ng -v
which says at the end
Warning: The current version of Node (16.9.1) is not supported by Angular.
to downgrade your Node version you can follow the instructions on this post:
How to downgrade Node version
You can also see all the Node versions available here:
https://nodejs.org/es/about/releases/
Since Angular is a step behind of Node I suggest to download an Active version and not a current one.

Kotlin Multiplatform Mobile unable to run on iOS: Execution failed for task ':shared:compileKotlinIosX64'

I have created fresh project(Hello World) in KMM followed by their official website. In android it works smooth but when I am trying to run in XCode it's giving errors because of which I am unable to build / run the xcode project. I have attached screenshots and logs for my errors. Somehow xcode scheme is not getting generated in the KMM platform that's what I am guessing.
Can anyone please help me understand what am I missing?
Any help would be appriciated.
Following is my dev env:
Xcode 11.4.1
Android 4.1.2
Kotling Plugin version 1.4.30 (stable)
KMM 0.2.0```
XCode Logs:
> Task :shared:compileKotlinIosX64
Downloading native dependencies (LLVM, sysroot etc). This is a one-time action performed only on the first run of the compiler.
Extracting dependency: /Users/fatin/.konan/cache/clang-llvm-apple-8.0.0-darwin-macos.tar.gz into /Users/fatin/.konan/dependencies
e: java.lang.RuntimeException: Cannot extract archive with dependency: /Users/fatin/.konan/cache/clang-llvm-apple-8.0.0-darwin-macos.tar.gz.
> Task :shared:compileKotlinIosX64 FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':shared:compileKotlinIosX64'.
> Compilation finished with errors
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
1 actionable task: 1 executed
Command PhaseScriptExecution failed with a nonzero exit code ```
[![enter image description here][3]][3]
I reached out to community for this and finally found the solution. Here is the link to that issue which I raised and solved this problem.
If anyone else is going through this same issue it mostly cause of corrupted kotlin file.
Also try checking your cmd line tools in XCode as per comments.
Hope this helps someone. Cheers.
If the project doesn't run right away even on opening it from Xcode and shows the shared framework is missing, Then try generating the shared framework for iOS platform using terminal. Navigate to the project folder and execute
Command: ./gradlew packForXcode Now the shared framework should have a xcode-frameworks product and you should be able to build and run the project through Xcode.
This could happen if there are two libraries, where one library was compiled against the different version of the other library than the one currently used in the project. Please check that the project configuration is correct and has consistent versions of dependencies.

Cordova / Crosswalk Could not resolve all dependencies for configuration ':_armv7DebugCompile'

cordova-plugin-crosswalk-webview seems to be broken out-of-the-box. Tested with cordova 5.1.1 and 6.1.1 on OSX.
Solutions from Crosswalk Could not resolve all dependencies for configuration ':_armv7DebugCompile' and Could not resolve all dependencies for configuration ':_armv7DebugCompile' did not work out.
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
null
org.xwalk:xwalk_core_library_beta:18+
Download https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library_beta/18.48.477.13/xwalk_core_library_beta-18.48.477.13.pom
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugCompile'.
> Could not resolve org.xwalk:xwalk_core_library_beta:18+.
Required by:
:android:unspecified
> Failed to move file '/private/var/folders/jr/3q77kjzd3yqfw_cllng_7c8c0000gn/T/gradle_download7281456311478481267bin'
I checked e.g. the following: Android Support Repository andGoogle
Repositoryand evenLocal Maven repository for Support` are
installed
Not working with cordova 5.1.? and 6.1.1 and various versions of
crosswalk
PATH and ANDROID_HOME are set
What do I miss?
I see that you use default crosswalk version, so no need install in local. It's available in https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library_beta/18.48.477.13/.
From the log, it seems that 18.48.477.13 version is not found via network. It may be proxy issue, such as JAVA_OPTS, Gradle, Maven. You can check for whether need them.
Or you can share your steps, let me have a try, the build steps for cordova-plugin-crosswalk-webview work well on my OSX.
We found the problem and the solution.
For some reason the following folders / file were owned by root, not my user such that building xwalk was prevented systemwide because of missing permissions.
Simply move the following to somewhere (delete also works) with sudo:
/Users/palinka/.gradle/caches/modules-2/metadata-2.14/descriptors/org.xwalk
/Users/palinka/.gradle/caches/modules-2/metadata-2.14/module-artifacts.bin
/Users/palinka/.gradle/caches/modules-2/files-2.1/org.xwalk
We got additional debug output by compling with
gradle cdvBuildDebug -P android.useDeprecatedNdk=true --debug
in platforms/android.

Nothing at all happens when running cordova prepare ios

I am in a ionic app at its root folder. I have a config.xml file and am having trouble getting it to build. I had no issues a few weeks ago, but I've screwed something up on my system I think. I have reinstalled both cordova and ionic and re-pulled the repo.
However, when I run ionic prepare ios --verbose literally nothing happens.
This is the only output:
ConfigXml.setConfigXml /Users/ben/code/project/app resetContent=true, errorWhenNotFound=false
ANY guidance as to what I should try next is very much appreciated.
cordova version is 5.2.0
npm version is 3.3.12
node version is v5.4.1
ionic version is 1.7.14
cordova platform ls outputs:
Installed platforms: ios 3.9.1
Available platforms: amazon-fireos, android, blackberry10, browser, firefoxos, webos
As mentioned in this thread on Github, there is an issue in Node v5 that makes ionic prepare fail.
In order to solve it you can try a couple of things.
One would be to update your cordova installation to version 5.4 or later, since it includes a fix for the Node v5 problem. You can do that using following code:
npm install -g cordova
The other suggested solution in the link is to reset the state of your ionic installation. Be aware that issuing this command will do following (as specified in Ionic-cli github page):
The ionic state reset method will first remove your platforms and
plugins folders. Then it will look at your package.json file to
re-install the platforms and plugins as specified there.
This command can be helpful for you to reinstall your plugins and
platforms to get a fresh start.
If you are willing to try, you can do it with following command:
ionic state reset
Personally I would try first to upgrade Cordova.
Try:
sudo ionic prepare ios --verbose
Whenever you install new plugins or platforms you must also change the read/write permissions on root folder for your project.

Undefined error when executing command to list PhoneGap plugins (iOS)

We're on PhoneGap 3.2, but the command to list plugins is generating an error:
w prompt$ phonegap local plugin list
[error] undefined
We're building for iOS. We have successfully installed several plugins, which are verified by looking at the plugins folder.
Did the command syntax change in 3.2, or is this a bug?
This was an issue that has just recently been fixed (About an hour from the posting of this answer).
Google Groups Discussion
To correct it just do the following
$ npm install -g phonegap

Resources