Can't build android mac os

i can’t build Android any app in my iMac machine

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

   @ionic/cli-utils  : 1.19.2
   ionic (Ionic CLI) : 3.20.0

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.1.1
   ios-deploy        : 1.9.2
   ios-sim           : 6.1.2
   Node              : v8.11.1
   npm               : 5.6.0
   OS                : macOS High Sierra
   Xcode             : Xcode 9.2 Build version 9C40b

Environment Variables:

   ANDROID_HOME : /Users/anspireagency/Library/Android/sdk/

Misc:

   backend : pro

Hello,

that’s simple, buy a windows or linux machine. Okay, little bit joking.

Do you have an error message or could describe it a bit more specific.

Best regards, anna-liebt

hi anna … thanks for your reply
this error i’m getting when i try to build

:app:transformClassesWithStackFramesFixerForDebug

UP-TO-DATE
:app:transformClassesWithDesugarForDebug

UP-TO-DATE
:app:transformClassesWithDexBuilderForDebug
 UP-TO-DATE
:app:transformDexArchiveWithExternalLibsDexMergerForDebug

UP-TO-DATE
:app:transformDexArchiveWithDexMergerForDebug

UP-TO-DATE
:CordovaLib:compileDebugNdk NO-SOURCE
:CordovaLib:mergeDebugJniLibFolders
 UP-TO-DATE
:CordovaLib:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNativeLibsWithStripDebugSymbolForDebug

UP-TO-DATE
:CordovaLib:transformNativeLibsWithIntermediateJniLibsForDebug
 UP-TO-DATE
:app:mergeDebugJniLibFolders UP-TO-DATE

:app:transformNativeLibsWithMergeJniLibsForDebug

UP-TO-DATE
:app:transformNativeLibsWithStripDebugSymbolForDebug
 FAILED
45 actionable tasks: 2 executed, 43 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformNativeLibsWithStripDebugSymbolForDebug'.
> A problem occurred starting process 'command '/Users/anspireagency/Library/Android/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/bin/mips64el-linux-android-strip''

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

* Get more help at https://help.gradle.org

BUILD FAILED in 6s
(node:8271) UnhandledPromiseRejectionWarning: Error: /Users/anspireagency/Desktop/development/Archive 2/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformNativeLibsWithStripDebugSymbolForDebug'.
> A problem occurred starting process 'command '/Users/anspireagency/Library/Android/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/bin/mips64el-linux-android-strip''

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

* Get more help at https://help.gradle.org

BUILD FAILED in 6s
    at ChildProcess.whenDone (/Users/anspireagency/Desktop/development/Archive 2/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:8271) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8271) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Hello,
i have really no knowlege about that.

Try following. Open SDK Manager, go sdk tools tab, remove NDK ( if you do not use any ndk things)

Best regards, anna-liebt

2 Likes

thank you very much anna the BUILD SUCCESSFUL now i’m trying to use --prod and --release
i got this error

ionic cordova build android --prod --release
Running app-scripts build: --prod --platform android --target cordova
[18:23:28]  build prod started ...
[18:23:29]  clean started ...
[18:23:29]  clean finished in 5 ms
[18:23:29]  copy started ...
[18:23:29]  deeplinks started ...
[18:23:30]  deeplinks finished in 267 ms
[18:23:30]  ngc started ...
[18:23:47]  typescript error
            Type AppHomePage in /Users/anspireagency/Desktop/development/Archive 2/src/pages/app-home/app-home.ts is
            part of the declarations of 2 modules: AppModule in /Users/anspireagency/Desktop/development/Archive
            2/src/app/app.module.ts and AppHomePageModule in /Users/anspireagency/Desktop/development/Archive
            2/src/pages/app-home/app-home.module.ts! Please consider moving AppHomePage in
            /Users/anspireagency/Desktop/development/Archive 2/src/pages/app-home/app-home.ts to a higher module that
            imports AppModule in /Users/anspireagency/Desktop/development/Archive 2/src/app/app.module.ts and
            AppHomePageModule in /Users/anspireagency/Desktop/development/Archive
            2/src/pages/app-home/app-home.module.ts. You can also create a new NgModule that exports and includes
            AppHomePage in /Users/anspireagency/Desktop/development/Archive 2/src/pages/app-home/app-home.ts then import
            that NgModule in AppModule in /Users/anspireagency/Desktop/development/Archive 2/src/app/app.module.ts and
            AppHomePageModule in /Users/anspireagency/Desktop/development/Archive
            2/src/pages/app-home/app-home.module.ts.

Error: The Angular AoT build failed. See the issues above
    at /Users/anspireagency/Desktop/development/Archive 2/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:237:55
    at step (/Users/anspireagency/Desktop/development/Archive 2/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:32:23)
    at Object.next (/Users/anspireagency/Desktop/development/Archive 2/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:13:53)
    at fulfilled (/Users/anspireagency/Desktop/development/Archive 2/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:4:58)

Hello,
ha ha ha. That was a solution, that I got from something that have nothing to do with ionic. Nice to see it is working.

Next:
It is like the error message says. You have a declaraction inside of two different ngModule .
For eager loading you make declaration in ngmodule of app.component.ts
For lazy loading you make declaration in ngmodule of whatever.module.ts (or module.ts).

You can mix eager loading and lazy loading for different pages, but for a page itself you must use eager loaded or lazy loaded.

The error message says you too, which page you must look for.

Ps: eager loaded page are used as object, lazy loaded are used as string.

Best regards, anna-liebt

but i don’t use lazy loading in my app …

Hello,
but the error is the same, independ of eager loading or lazy loading. You can not add a page to two different ngModule.

If you use eager loading, then go to app-home.module.ts and you can comment out all lines with //. You can also delete app-home.module.ts file, but if you decide later switching to lazy loading, then you can remove comment // and comment out the page in app.module.ts.

Best regards, anna-liebt

hello,
yes i figure it and

import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { TopicListPage } from './topic-list';

@NgModule({
  // declarations: [
  //   TopicListPage,
  // ],
  // imports: [
  //   IonicPageModule.forChild(TopicListPage),
  // ],
})
export class TopicListPageModule {}

Thank you. I appreciate your effort

Hello,
in case of eager loading you can comment out all lines. In that case you are sure that there not unwanted side effects.

Best regards, anna-liebt

Ps: I go bikeing bevor it’s to late.

Worked For me
Thanks