CordovaError: Platform ios already added - visual-studio-cordova

I am running on OS X El Capitan. I am working with VSTS and have the TACO plug installed and also have an ios agent running.
I am following these steps trying to build for IOS.
https://www.visualstudio.com/en-us/docs/build/apps/mobile/cordova-build
I have an agent running in interatice mode:
https://www.visualstudio.com/en-us/docs/build/admin/agents/v2-osx
However, the Cordova build step is failing and I cannot understand why after checking all the steps a few times. See bolded error.
***************************************************************************** Finishing: npm install
****************************************************************************** Starting: Cordova Build ios
============================================================================== Task : Cordova Build Description : Build a hybrid app project
based on the Cordova CLI, Ionic CLI, TACO CLI, or other
Cordova-compliant CLI Version : 1.3.9 Author : Microsoft
Corporation Help : More
Information
============================================================================== DEVELOPER_DIR was undefined DEVELOPER_DIR for build set to
/Applications/Xcode8.0.app/Contents/Developer Input to
determineIdentity:
1 valid identities found
XXX
(YGKU7EWJD4)","keychain":"/Users/jordanmc/Documents/repos/myApp/1/s/_tasktmp.keychain"}
Input to determineProfile:
XXX Got rid of som sensitive info
Module cache at /Users/jordanmc/.taco_home/node_modules cordova
already installed. Adding Xcconfig update hook Module cache at
/Users/jordanmc/.taco_home/node_modules cordova already installed.
Adding support plugin. cp: no such file or directory:
/Users/jordanmc/Documents/repos/myApp/resources/ios/icon/icon-40#3x.png
cp: no such file or directory:
/Users/jordanmc/Documents/repos/myApp/resources/ios/icon/icon-83.5#2x.png
Removing Xcconfig update hook { CordovaError: Platform ios already
added.
at /Users/jordanmc/.taco_home/node_modules/cordova/6.4.0/node_modules/cordova-lib/src/cordova/platform.js:130:31
at _fulfilled (/Users/jordanmc/.taco_home/node_modules/cordova/6.4.0/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/Users/jordanmc/.taco_home/node_modules/cordova/6.4.0/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/Users/jordanmc/.taco_home/node_modules/cordova/6.4.0/node_modules/q/q.js:749:13)
at /Users/jordanmc/.taco_home/node_modules/cordova/6.4.0/node_modules/q/q.js:557:44
at flush (/Users/jordanmc/.taco_home/node_modules/cordova/6.4.0/node_modules/q/q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:67:7) Task failed
> at process._tickCallback (internal/process/next_tick.js:98:9) name: 'CordovaError', message: 'Platform ios already added.',
code: 0, context: undefined }
****************************************************************************** Finishing: Cordova Build ios
****************************************************************************** Starting: Post Job Cleanup
****************************************************************************** Cleaning any cached credential from repository: XXX
****************************************************************************** Finishing: Post Job Cleanup
****************************************************************************** Finishing: Build
I have this configured:
Any help would be great!

Related

Flutter: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin'

I have been trying to run my Flutter code on IOS device. However I am getting some errors regarding non-modular headers inside Framework module.
Logs:
While building module 'firebase_core' imported from
/Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/fi
rebase_auth-0.20.0+1/ios/Classes/FLTFirebaseAuthPlugin.m:5:
In file included from <module-includes>:1:
In file included from
/Users/admin/Desktop/Ali/GuestInMe/ios/Pods/Target Support
Files/firebase_core/firebase_core-umbrella.h:13:
In file included from
/Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/fi
rebase_core-0.7.0/ios/Classes/FLTFirebaseCorePlugin.h:11:
/Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/fi
rebase_core-0.7.0/ios/Classes/FLTFirebasePlugin.h:9:9: error:
include of non-modular header inside framework module
'firebase_core.FLTFirebasePlugin':
'/Users/admin/Desktop/Ali/GuestInMe/ios/Pods/Headers/Public/Firebase
Core/FirebaseCore.h'
[-Werror,-Wnon-modular-include-in-framework-module]
#import <FirebaseCore/FirebaseCore.h>
^
1 error generated.
/Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/fi
rebase_auth-0.20.0+1/ios/Classes/FLTFirebaseAuthPlugin.m:5:9: fatal
error: could not build module 'firebase_core'
#import <firebase_core/FLTFirebasePluginRegistry.h>
~~~~~~~^
2 errors generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
What I have tried:
I tried to change build settings of Xcode and allow non-modular imports -> flutter clean -> pod install in ios folder -> flutter run
Tried changing the file to public from project, but it already was public.
Reinstall all the pod files.
'firebase_core.FLTFirebasePlugin':
What worked eventually:
Put all the pubspec.yaml dependencies to the latest version.
Delete pubspec.lock, Pods folder in ios and Podfile.lock
Run flutter clean -> flutter pub get -> cd ios -> pod install -> cd .. -> flutter run
And you should be good to go
You can fix it by editing Podfile
post_install do |installer|
installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
end
end

react-native build failed after installing admob module

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1001 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
> Configure project :react-native-firebase_admob
:react-native-firebase_admob package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/admob/package.json
:react-native-firebase_app package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/app/package.json
:react-native-firebase_admob:firebase.bom using default value: 26.3.0
:react-native-firebase_admob:ads.consent using default value: 1.0.6
:react-native-firebase_admob package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/admob/package.json
:react-native-firebase_admob:version set from package.json: 10.5.1 (10,5,1 - 10005001)
:react-native-firebase_admob:android.compileSdk using custom value: 29
:react-native-firebase_admob:android.targetSdk using custom value: 29
:react-native-firebase_admob:android.minSdk using custom value: 16
:react-native-firebase_admob:reactNativeAndroidDir /home/muhamed-kveshkshaano/suck/node_modules/react-native/android
> Configure project :react-native-firebase_app
:react-native-firebase_app package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/app/package.json
:react-native-firebase_app:firebase.bom using default value: 26.3.0
:react-native-firebase_app:play.play-services-auth using default value: 19.0.0
:react-native-firebase_app package.json found at /home/muhamed-kveshkshaano/suck/node_modules/#react-native-firebase/app/package.json
:react-native-firebase_app:version set from package.json: 10.5.0 (10,5,0 - 10005000)
:react-native-firebase_app:android.compileSdk using custom value: 29
:react-native-firebase_app:android.targetSdk using custom value: 29
:react-native-firebase_app:android.minSdk using custom value: 16
:react-native-firebase_app:reactNativeAndroidDir /home/muhamed-kveshkshaano/suck/node_modules/react-native/android
> Task :react-native-firebase_app:compileDebugJavaWithJavac
> Task :app:processDebugResources FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
37 actionable tasks: 29 executed, 8 up-to-date
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/home/muhamed-kveshkshaano/.gradle/caches/transforms-2/files-2.1/820765fbb4c63d086027395fb7f0dacc/play-services-ads-lite-19.6.0/AndroidManifest.xml:27:5-38:15: AAPT: error: unexpected element <queries> found in <manifest>.
* 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 32s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Note: Some input files use or override a deprecated API.
here is the error, the main problem is each i install admob module #react-native-firebase/admob, it throws this error after trying a lot i couldnt find any solution, it only happens after installing admob module except that it build well, anyone knows whats wrong with that module
I was with the same problem and it work for me
in android/app/build.gradle
defaultConfig {
...
multiDexEnabled true // added for admob problem
}
...
dependencies {
...
implementation "androidx.multidex:multidex:2.0.1" // fix firebaseAdmob
}
in android/build.gradle
dependencies {
classpath('com.android.tools.build:gradle:4.1.2')
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.3.3'
}
now open the android folder in Android Studio and wait for gradle will update
when finish the gradle update run npx react-native run-android
downgrade all the rnfirebase libraries that you are using to less than 10.0.0 (admob 7.6.11 and app 9.0.0), as I show in the image

How to fix Firebase Analytics Plugin install error

I am trying to install firebase analytics plugin in my ionic project using
sudo ionic cordova plugin add cordova-plugin-firebase-analytics
But i get this as my error and the plugin isnt installed. I have tried pod install and pod update but it still gives the same error
> cordova plugin add cordova-plugin-firebase-analytics
Installing "cordova-plugin-firebase-analytics" for ios
Failed to install 'cordova-plugin-firebase-analytics': undefined
CordovaError: Promise rejected with non-error: '/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin18/rbconfig.rb:215: warning: Insecure world writable dir /Users/villifixinc/Documents/TravelApp in PATH, mode 040777\n/Library/Ruby/Gems/2.3.0/gems/claide-1.0.3/lib/claide/command.rb:439:in `help!\': \u001b[31m[!] You cannot run CocoaPods as root.\u001b[39m (CLAide::Help)\n\n\u001b[4mUsage:\u001b[24m\n\n $ \u001b[32mpod\u001b[39m \u001b[32mCOMMAND\u001b[39m\n\n CocoaPods, the Cocoa library package manager.\n\n\u001b[4mCommands:\u001b[24m\n\n \u001b[32m+ cache\u001b[39m Manipulate the CocoaPods cache\n \u001b[32m+ env\u001b[39m Display pod environment\n \u001b[32m+ init\u001b[39m Generate a Podfile for the current directory\n \u001b[32m+ install\u001b[39m Install project dependencies according to versions from a\n Podfile.lock\n \u001b[32m+ ipc\u001b[39m Inter-process communication\n \u001b[32m+ lib\u001b[39m Develop pods\n \u001b[32m+ list\u001b[39m List pods\n \u001b[32m+ outdated\u001b[39m Show outdated project dependencies\n \u001b[32m+ repo\u001b[39m Manage spec-repositories\n \u001b[32m+ setup\u001b[39m Setup the CocoaPods environment\n \u001b[32m+ spec\u001b[39m Manage pod specs\n \u001b[32m+ update\u001b[39m Update outdated project dependencies and create new Podfile.lock\n\n\u001b[4mOptions:\u001b[24m\n\n \u001b[34m--silent\u001b[39m Show nothing\n \u001b[34m--version\u001b[39m Show the version of the tool\n \u001b[34m--verbose\u001b[39m Show more debugging information\n \u001b[34m--no-ansi\u001b[39m Show output without ANSI codes\n \u001b[34m--help\u001b[39m Show help banner of specified command\n\tfrom /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:47:in `run\'\n\tfrom /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>\'\n\tfrom /usr/local/bin/pod:22:in `load\'\n\tfrom /usr/local/bin/pod:22:in `<main>\'\n'
at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:29:15)
at process._tickCallback (internal/process/next_tick.js:68:7)
[ERROR] An error occurred while running subprocess cordova.
cordova plugin add cordova-plugin-firebase-analytics exited with exit
code 1.
Re-running this command with the --verbose flag may provide more
information.
try installing the older version of the plugin. version 2.0.3 should fix your problem.

Error Running Gradle - gradlew.bat exited abnormally (Error after adding firebase)

I am trying to read the firestore database. I have:
* Registered My app on firebase .
* copied googleservices.json in the app directory.
* copied the dependencies as firebase instructed.
Flutter Doctor
Upgrading Flutter from C:\flutter...
fa174a123..f31fc1bd0 master -> origin/master
* [new branch] revert-34243-flutter_frame_event -> origin/revert-34243-flutter_frame_event
Updating b593f5167..7a4c33425
11 files changed, 488 insertions(+), 83 deletions(-)
Upgrading engine...
Flutter 1.5.4-hotfix.2 • channel stable •
Framework • revision 7a4c33425d (6 weeks ago) • 2019-04-29 11:05:24 -0700
Engine • revision 52c7a1e849
Tools • Dart 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)
Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.17763.557], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.4)
[!] IntelliJ IDEA Ultimate Edition (version 2019.1)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.35.1)
[√] Connected device (1 available)
! Doctor found issues in 1 category.
Error
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "C:\Users\USER\Desktop\crm\crm\crm\android\gradlew.bat" exited abnormally:
> Configure project :app
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
*********************************************************
WARNING: This version of cloud_firestore will break your Android build if it or its dependencies aren't compatible with AndroidX.
See for more information on the problem and how to fix it.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.4.0+4\android\build.gradle' line: 44
* What went wrong:
A problem occurred evaluating project ':firebase_core'.
> ..\..\pubspec.yaml (The system cannot find the file specified)
* 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
BUILD FAILED in 3s
Command: C:\Users\USER\Desktop\crm\crm\crm\android\gradlew.bat app:properties
Finished with error: Please review your Gradle project setup in the android/ folder.
PUBSPEC.YAML
name: flutter_charts_app
description: A new Flutter application.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org.
version: 1.0.0+1
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
flutter_sparkline: ^0.1.0
flutter_staggered_grid_view: ^0.2.7
flutter_circular_chart: ^0.1.0
font_awesome_flutter: ^8.2.0
cloud_firestore: ^0.12.5
firebase_core: ^0.4.0+4
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page:
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# For details regarding adding assets from package dependencies, see
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
When I review my gradlew.bat file. The "JAVA_HOME goto findJavaFromJavaHome" is underlined in red. But I have both Java and Gradle added to my enviroment variables and path.
#if "%DEBUG%" == "" #echo off
#rem ##########################################################################
#rem
#rem Gradle startup script for Windows
#rem
#rem ##########################################################################
#rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
#rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
#rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
#rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%#eval[2+2]" == "4" goto 4NT_args
:win9xME_args
#rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
#rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
#rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
#rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
#rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
This issue is resolved in the 0.4.0+5 release of firebase_core. Please try updating and let us know if you run into any further issues.
Just upgrade gradle and kotlin version. In my case
ext.kotlin_version: '1.2.71' -> '1.3.50'
It started working fine.
If issue still persist then keep in mind that this issue is specific to android so setup android project in Android Studio. All issue will be shown. Fix them and it will start working.

Ionic3 Execution failed for task ':app:transformClassesWithDexBuilderForDebug'

I have been dealing with this for the past 2 weeks now.I'm building an application with Ionic3. Everything worked fine, Untill I install phonegap push plugin. Then I start to get this error
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'. > com.android.build.api.transform.TransformException: java.lang.IllegalStateExce ption: Dex archives: setting .DEX extension only for .CLASS files
I have made research about this and none of the solution seemed to work for me. I have done below to app level build.gradle
defaultConfig {
multiDexEnabled true
}
i also added below code
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
Then I started gettin below error
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write
[C:\ionic\brinmiz\platforms\android\app\build
\intermediates\multi-dex\debug\componentClasses.jar] (Can't read
[C:\ionic\brinmiz\platforms\android\app\build\intermediates\transforms\desugar\debug\17.jar(;;;;;;**.class)] (Duplicate zip entry [17.jar:android/support/v4/media/RatingCompat$1.class]))
This is my Ionic info
cli packages:
#ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
#ionic/app-scripts : 3.1.8
Cordova Platforms : android 7.0.0 ios 4.5.4
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.0.2
Node : v6.10.2
npm : 3.10.10
OS : Windows 8
Environment Variables:
ANDROID_HOME : C:\Users\Dd\AppData\Local\Android\sdk
Misc:
backend : legacy
Like I said, I have been on this for the past 2 weeks. I really need your solution
As explained here by the official documentation of Push Plugin, there is a known incompatibility between Push Plugin and another plugins that "are using an outdated way to declare dependencies such as android-support or play-services-gcm".
You can try to install cordova-android-support-gradle-release that will align various versions of the Android Support libraries specified by other plugins to a specific version.
cordova plugin add cordova-android-support-gradle-release --fetch
Also you can try to downgrade your cordova-android from 7.0.0 to 6.3.0 because there are also known issues with 7.x+. Delete your plugin folder(make sure you have all of them declared in config.xml) and run:
cordova platforms rm android
cordova platforms add android#6.3.0
If nothing do the job, update your answer with all the plugins used by your application using the next command and I will try to debug for you.
cordova plugin ls

Resources