Error build ios and android with Ionic v3.8.0


#1

So I had a working version of my app. I upgraded to v3.8.0 from v3.7.0. I updated both platforms android and ios.

I am currently using:
cordova-ios version 4.5.3
cordova-android version 6.3.0
cordova-browser version 5.0.1

Here is my specific system info:

% ionic info

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.17.0
    ionic (Ionic CLI) : 3.17.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.0.1
    Cordova Platforms  : android 6.3.0 browser 5.0.1 ios 4.5.3
    Ionic Framework    : ionic-angular 3.8.0

System:

    Android SDK Tools : 26.1.1
    Node              : v8.9.1
    npm               : 5.5.1
    OS                : macOS Sierra
    Xcode             : Xcode 9.1 Build version 9B55

Environment Variables:

    ANDROID_HOME : /Users/USERNAME_HERE/Library/Android/sdk

Misc:

    backend : legacy

% ionic cordova requirements
> cordova requirements

Requirements check results for android:

Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed

Please install Android target / API level: "android-26".

Hint: Open the SDK manager by running: /Users/USERNAME_HERE/Library/Android/sdk/tools/android
You will require:
1. "SDK Platform" for API level android-26
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)

Gradle: installed /Applications/Android Studio.app/Contents/gradle/gradle-4.1/bin/gradle


Requirements check results for browser:
Error: Cannot read property 'forEach' of undefined

excerpt from my .zshrc

export PATH=/usr/local/bin:$PATH

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)

export ANDROID_HOME=/Users/USERNAME_HERE/Library/Android/sdk
export ANDROID_NDK_HOME=/usr/local/opt/android-ndk
export ANDROID_SDK_ROOT=/Users/USERNAME_HERE/Library/Android/sdk

export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/build-tools/26.0.3:$PATH
export PATH=$ANDROID_HOME/platforms/android-26:$PATH

here is my config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.companynamehere.AppNameHere" version="2.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>APP NAME HERE</name>
    <description>DESCRIPTION HERE.</description>
    <author email="EMAIL ADDRESS" href="URL TO COMPANY">COMPANY NAME HERE</author>
    <content src="index.html" />
    <access origin="*" />
    <allow-navigation href="http://ionic.local/*" />
    <allow-navigation href="http://10.1.2.7:8100" />
    <allow-navigation href="http://10.1.2.101:8100" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <preference name="KeychainAccessibility" value="WhenUnlocked" />
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
        <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
        <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
        <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
        <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
        <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
        <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
        <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
    </platform>
    <preference name="webviewbounce" value="false" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="android-minSdkVersion" value="16" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="FadeSplashScreenDuration" value="300" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="3000" />
    <feature name="StatusBar">
        <param name="ios-package" onload="true" value="CDVStatusBar" />
    </feature>
    <icon src="resources/android/icon/drawable-xhdpi-icon.png" />
    <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
    <engine name="ios" spec="~4.5.3" />
    <engine name="browser" spec="~5.0.1" />
    <engine name="android" spec="6.3.0" />
    <plugin name="cordova-plugin-secure-storage" spec="^2.6.8" />
    <plugin name="cordova-plugin-camera" spec="^2.4.1">
        <variable name="CAMERA_USAGE_DESCRIPTION" value="DESCRIPTION HERE." />
        <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="DESCRIPTION HERE." />
    </plugin>
    <plugin name="cordova-plugin-console" spec="^1.0.7" />
    <plugin name="cordova-plugin-device" spec="^1.1.6" />
    <plugin name="cordova-plugin-google-analytics" spec="^1.8.2" />
    <plugin name="cordova-plugin-screen-orientation" spec="^2.0.1" />
    <plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
    <plugin name="cordova-plugin-statusbar" spec="^2.2.3" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
    <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
</widget>

ionic cordova build android --verbose --debug

[DEBUG] Reason for not using local CLI: LOCAL_CLI_NOT_FOUND
[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: '/Users/USERNAMEHERE/Workspace/appnamehere', local: false, binPath:
        '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/usr/local/lib/node_modules/ionic/dist/index.js' }
[DEBUG] Daemon found (pid: 863)
Running app-scripts build: --platform android --target cordova
[14:14:19]  build dev started ...
[14:14:19]  clean started ...
[14:14:19]  clean finished in 2 ms
[14:14:19]  copy started ...
[14:14:19]  deeplinks started ...
[14:14:19]  deeplinks finished in 147 ms
[14:14:19]  transpile started ...
[14:14:22]  transpile finished in 2.96 s
[14:14:22]  preprocess started ...
[14:14:22]  preprocess finished in less than 1 ms
[14:14:22]  webpack started ...
[14:14:22]  copy finished in 3.24 s
[14:14:28]  webpack finished in 6.65 s
[14:14:28]  sass started ...
[14:14:29]  sass finished in 930 ms
[14:14:29]  postprocess started ...
[14:14:29]  postprocess finished in 6 ms
[14:14:29]  lint started ...
[14:14:29]  build dev finished in 10.82 s
> cordova build android --debug
ANDROID_HOME=/Users/USERNAMEHERE/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home
Subproject Path: CordovaLib
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
	at build_5fesacc4wautzb7t2yoox8mug.run(/Users/USERNAMEHERE/Workspace/vbasmobile/platforms/android/build.gradle:141)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.

Incremental java compilation is an incubating feature.

The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> java.lang.NullPointerException (no error message)

* 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: 1.058 secs

Error: /Users/usernamehere/Workspace/appnamehere/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> java.lang.NullPointerException (no error message)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

[ERROR] An error occurred while running cordova build android --debug (exit code 1).

On the iOS build I have to run with sudo because it tries using iPhone X emulator and has permission errors when deleting platform/ios/build/emulator.

sudo ionic cordova build ios --debug --verbose

[DEBUG] Reason for not using local CLI: LOCAL_CLI_NOT_FOUND
[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: '/Users/username/Workspace/appname', local: false, binPath:
        '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/usr/local/lib/node_modules/ionic/dist/index.js' }
[DEBUG] Daemon found (pid: 863)
Running app-scripts build: --platform ios --target cordova
[14:21:26]  build dev started ...
[14:21:26]  clean started ...
[14:21:26]  clean finished in 2 ms
[14:21:26]  copy started ...
[14:21:26]  deeplinks started ...
[14:21:26]  deeplinks finished in 154 ms
[14:21:26]  transpile started ...
[14:21:29]  transpile finished in 3.00 s
[14:21:29]  preprocess started ...
[14:21:29]  preprocess finished in 1 ms
[14:21:29]  webpack started ...
[14:21:29]  copy finished in 3.28 s
[14:21:36]  webpack finished in 7.07 s
[14:21:36]  sass started ...
[14:21:37]  sass finished in 934 ms
[14:21:37]  postprocess started ...
[14:21:37]  postprocess finished in 6 ms
[14:21:37]  lint started ...
[14:21:37]  build dev finished in 11.33 s
> cordova build ios --debug
Building for iPhone X Simulator

Building project: /Users/usernamehere/Workspace/appname/platforms/ios/AppName.xcworkspace

	Configuration: Debug
	Platform: emulator
Build settings from command line:
    CONFIGURATION_BUILD_DIR = /Users/usernamehere/Workspace/appnamehere/platforms/ios/build/emulator
    SDKROOT = iphonesimulator11.1
    SHARED_PRECOMPS_DIR = /Users/usernamehere/Workspace/appname/platforms/ios/build/sharedpch

Build settings from configuration file '/Users/usernamehere/Workspace/appname/platforms/ios/cordova/build-debug.xcconfig':
    CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
    CODE_SIGN_ENTITLEMENTS = $(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-$(CONFIGURATION).plist
    CODE_SIGN_IDENTITY = iPhone Developer
    ENABLE_BITCODE = NO
    GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1
    HEADER_SEARCH_PATHS = "$(TARGET_BUILD_DIR)/usr/local/lib/include" "$(OBJROOT)/UninstalledProducts/include" "$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include" "$(BUILT_PRODUCTS_DIR)"
    OTHER_LDFLAGS = -ObjC
    SWIFT_OBJC_BRIDGING_HEADER = $(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h

… continues with a bunch of output and towards the end errors…

uplicate symbol _OBJC_CLASS_$_CDVLogger in:
    /var/root/Library/Developer/Xcode/DerivedData/AppName-botvmxovnofgvnfnrkfzzbakaloq/Build/Intermediates.noindex/AppName.build/Debug-iphonesimulator/AppName.build/Objects-normal/x86_64/CDVLogger.o
    /Users/username/Workspace/appname/platforms/ios/build/emulator/libCordova.a(CDVLogger.o)
duplicate symbol _OBJC_METACLASS_$_CDVLogger in:
    /var/root/Library/Developer/Xcode/DerivedData/AppName-botvmxovnofgvnfnrkfzzbakaloq/Build/Intermediates.noindex/VbasMobile.build/Debug-iphonesimulator/AppName.build/Objects-normal/x86_64/CDVLogger.o
    /Users/username/Workspace/appname/platforms/ios/build/emulator/libCordova.a(CDVLogger.o)
ld: 2 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **


The following build commands failed:
	Ld build/emulator/AppName.app/AppName normal x86_64
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/username/Workspace/appname/platforms/ios/cordova/build-debug.xcconfig,-workspace,AppName.xcworkspace,-scheme,AppName,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,name=iPhone X,build,CONFIGURATION_BUILD_DIR=/Users/username/Workspace/appname/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/username/Workspace/appname/platforms/ios/build/sharedpch

[ERROR] An error occurred while running cordova build ios --debug (exit code 1).