1

Estoy tratando de generar una apk para mi proyecto IONIC 3, ya he agregado la plataforma android con cordoba y ejecuté el siguiente comando:

ionic cordova build android --prod --release

con el siguiente resultado

Running app-scripts build: --prod --platform android --target cordova
[16:33:43]  build prod started ...
[16:33:43]  clean started ...
[16:33:43]  clean finished in 16 ms
[16:33:43]  copy started ...
[16:33:43]  ngc started ...
Error: Encountered undefined provider! Usually this means you have a circular dependencies (might be caused by using 'barrel' index.ts files.
    at Error (native)
    at syntaxError (C:\Users\Jair Acevedo\IONIC_PROJECTS\Quizionic2Evanto\Quiz_IPMA_001\node_modules\@angular\compiler\bundles\compiler.umd.js:1550:34)
    at C:\Users\Jair Acevedo\IONIC_PROJECTS\Quizionic2Evanto\Quiz_IPMA_001\node_modules\@angular\compiler\bundles\compiler.umd.js:14936:40
    at Array.forEach (native)
    at CompileMetadataResolver._getProvidersMetadata (C:\Users\Jair Acevedo\IONIC_PROJECTS\Quizionic2Evanto\Quiz_IPMA_001\node_modules\@angular\compiler\bundles\compiler.umd.js:14921:19)
    at CompileMetadataResolver.getNgModuleMetadata (C:\Users\Jair Acevedo\IONIC_PROJECTS\Quizionic2Evanto\Quiz_IPMA_001\node_modules\@angular\compiler\bundles\compiler.umd.js:14576:50)
    at addNgModule (C:\Users\Jair Acevedo\IONIC_PROJECTS\Quizionic2Evanto\Quiz_IPMA_001\node_modules\@angular\compiler\bundles\compiler.umd.js:23050:58)
    at C:\Users\Jair Acevedo\IONIC_PROJECTS\Quizionic2Evanto\Quiz_IPMA_001\node_modules\@angular\compiler\bundles\compiler.umd.js:23061:14
    at Array.forEach (native)
    at _createNgModules (C:\Users\Jair Acevedo\IONIC_PROJECTS\Quizionic2Evanto\Quiz_IPMA_001\node_modules\@angular\compiler\bundles\compiler.umd.js:23060:26)
[16:34:05]  copy finished in 21.96 s

app.module.ts

import { NgModule, ErrorHandler, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { Device } from '@ionic-native/device';
import { MyApp } from './app.component';
import { HttpModule } from '@angular/http';
import { BrowserModule } from '@angular/platform-browser';
import { IonicStorageModule } from '@ionic/storage';
import { WelcomePage } from '../pages/welcome/welcome';
import { DeveloperPage } from '../pages/developer/developer';
import { ExamListPage } from '../pages/exam-list/exam-list';
import { ExamDetailsPage } from '../pages/exam-details/exam-details';
import { TrackerListPage } from '../pages/tracker-list/tracker-list';
import { StoreDetailPage } from '../pages/store-details/store-details';
import { LoginPage } from '../pages/login/login';
import { Pin } from '../pages/pin/pin';
import { PINDetailPage } from '../pages/pin-detail/pin-detail';
import { TrackerExamDetailPage } from '../pages/tracker-details/tracker-details';
import { StoreListPage } from '../pages/store-list/store-list';
import { DbService } from '../providers/db-service';
import { SQLite } from '@ionic-native/sqlite';
import { StoreService } from '../providers/store-service';
import { FbProvider } from '../providers/fb-provider';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { GoogleAnalytics } from '@ionic-native/google-analytics';
import { AdMob } from '@ionic-native/admob';

@NgModule({
  declarations: [
    MyApp,
    WelcomePage,
    DeveloperPage,
    ExamListPage,
    ExamDetailsPage,
    StoreDetailPage,
    TrackerExamDetailPage,
    TrackerListPage,
    StoreListPage,
    LoginPage,
    Pin,
    PINDetailPage

  ],
  imports: [
    BrowserModule,
    HttpModule,
    IonicStorageModule.forRoot(),
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    WelcomePage,
    DeveloperPage,
    ExamDetailsPage,
    StoreDetailPage,
    TrackerExamDetailPage,
    ExamListPage,
    TrackerListPage,
    StoreListPage,
    LoginPage,
    Pin,
    PINDetailPage
  ],
  providers: [
    StatusBar, SplashScreen, GoogleAnalytics, Device, AdMob, SQLite, DbService, StoreService, Storage, FbProvider,
    {provide: ErrorHandler, useClass: IonicErrorHandler}],
  schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
export class AppModule {}

Ahora ejecutando el mismo comando pero con sin el "Storage" en mis providers.

[17:06:19]  lint finished in 5.54 s
ANDROID_HOME=C:\Users\Jair Acevedo\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144
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_3penkgd1tmhhii3p0pnkbc2l5.run(C:\Users\Jair Acevedo\IONIC_PROJECTS\Quizionic2Evanto\Quiz_IPMA_001\platforms\android\build.gradle:138)
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'.
> Could not resolve all dependencies for configuration ':_debugApkCopy'.
   > Could not find com.android.support:support-v4:27.0.2.
     Searched in the following locations:
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/27.0.2/support-v4-27.0.2.pom
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/27.0.2/support-v4-27.0.2.jar
         file:/C:/Users/Jair Acevedo/IONIC_PROJECTS/Quizionic2Evanto/Quiz_IPMA_001/platforms/android/sdk-manager/com/android/support/support-v4/27.0.2/support-v4-27.0.2.jar
     Required by:
         project : > com.google.android.gms:play-services-ads:11.0.4 > com.google.android.gms:play-services-basement:11.0.4
   > Could not find com.android.support:support-annotations:27.0.2.
     Searched in the following locations:
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.2/support-annotations-27.0.2.pom
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.2/support-annotations-27.0.2.jar
         file:/C:/Users/Jair Acevedo/IONIC_PROJECTS/Quizionic2Evanto/Quiz_IPMA_001/platforms/android/sdk-manager/com/android/support/support-annotations/27.0.2/support-annotations-27.0.2.jar
     Required by:
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-core:4.30.0
   > Could not find com.android.support:support-core-utils:27.0.2.
     Searched in the following locations:
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-core-utils/27.0.2/support-core-utils-27.0.2.pom
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-core-utils/27.0.2/support-core-utils-27.0.2.jar
         file:/C:/Users/Jair Acevedo/IONIC_PROJECTS/Quizionic2Evanto/Quiz_IPMA_001/platforms/android/sdk-manager/com/android/support/support-core-utils/27.0.2/support-core-utils-27.0.2.jar
     Required by:
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-core:4.30.0
   > Could not find com.android.support:support-v4:27.0.2.
     Searched in the following locations:
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/27.0.2/support-v4-27.0.2.pom
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/27.0.2/support-v4-27.0.2.jar
         file:/C:/Users/Jair Acevedo/IONIC_PROJECTS/Quizionic2Evanto/Quiz_IPMA_001/platforms/android/sdk-manager/com/android/support/support-v4/27.0.2/support-v4-27.0.2.jar
     Required by:
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-common:4.30.0
   > Could not find com.android.support:appcompat-v7:27.0.2.
     Searched in the following locations:
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.2/appcompat-v7-27.0.2.pom
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.2/appcompat-v7-27.0.2.jar
         file:/C:/Users/Jair Acevedo/IONIC_PROJECTS/Quizionic2Evanto/Quiz_IPMA_001/platforms/android/sdk-manager/com/android/support/appcompat-v7/27.0.2/appcompat-v7-27.0.2.jar
     Required by:
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-common:4.30.0
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-login:4.30.0
   > Could not find com.android.support:cardview-v7:27.0.2.
     Searched in the following locations:
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/cardview-v7/27.0.2/cardview-v7-27.0.2.pom
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/cardview-v7/27.0.2/cardview-v7-27.0.2.jar
         file:/C:/Users/Jair Acevedo/IONIC_PROJECTS/Quizionic2Evanto/Quiz_IPMA_001/platforms/android/sdk-manager/com/android/support/cardview-v7/27.0.2/cardview-v7-27.0.2.jar
     Required by:
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-common:4.30.0
   > Could not find com.android.support:customtabs:27.0.2.
     Searched in the following locations:
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/customtabs/27.0.2/customtabs-27.0.2.pom
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/customtabs/27.0.2/customtabs-27.0.2.jar
         file:/C:/Users/Jair Acevedo/IONIC_PROJECTS/Quizionic2Evanto/Quiz_IPMA_001/platforms/android/sdk-manager/com/android/support/customtabs/27.0.2/customtabs-27.0.2.jar
     Required by:
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-common:4.30.0

* 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: 14.752 secs
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugApkCopy'.
   > Could not find com.android.support:support-v4:27.0.2.
     Searched in the following locations:
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/27.0.2/support-v4-27.0.2.pom
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/27.0.2/support-v4-27.0.2.jar
         file:/C:/Users/Jair Acevedo/IONIC_PROJECTS/Quizionic2Evanto/Quiz_IPMA_001/platforms/android/sdk-manager/com/android/support/support-v4/27.0.2/support-v4-27.0.2.jar
     Required by:
         project : > com.google.android.gms:play-services-ads:11.0.4 > com.google.android.gms:play-services-basement:11.0.4
   > Could not find com.android.support:support-annotations:27.0.2.
     Searched in the following locations:
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.2/support-annotations-27.0.2.pom
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.2/support-annotations-27.0.2.jar
         file:/C:/Users/Jair Acevedo/IONIC_PROJECTS/Quizionic2Evanto/Quiz_IPMA_001/platforms/android/sdk-manager/com/android/support/support-annotations/27.0.2/support-annotations-27.0.2.jar
     Required by:
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-core:4.30.0
   > Could not find com.android.support:support-core-utils:27.0.2.
     Searched in the following locations:
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-core-utils/27.0.2/support-core-utils-27.0.2.pom
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-core-utils/27.0.2/support-core-utils-27.0.2.jar
         file:/C:/Users/Jair Acevedo/IONIC_PROJECTS/Quizionic2Evanto/Quiz_IPMA_001/platforms/android/sdk-manager/com/android/support/support-core-utils/27.0.2/support-core-utils-27.0.2.jar
     Required by:
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-core:4.30.0
   > Could not find com.android.support:support-v4:27.0.2.
     Searched in the following locations:
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/27.0.2/support-v4-27.0.2.pom
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/27.0.2/support-v4-27.0.2.jar
         file:/C:/Users/Jair Acevedo/IONIC_PROJECTS/Quizionic2Evanto/Quiz_IPMA_001/platforms/android/sdk-manager/com/android/support/support-v4/27.0.2/support-v4-27.0.2.jar
     Required by:
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-common:4.30.0
   > Could not find com.android.support:appcompat-v7:27.0.2.
     Searched in the following locations:
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.2/appcompat-v7-27.0.2.pom
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.2/appcompat-v7-27.0.2.jar
         file:/C:/Users/Jair Acevedo/IONIC_PROJECTS/Quizionic2Evanto/Quiz_IPMA_001/platforms/android/sdk-manager/com/android/support/appcompat-v7/27.0.2/appcompat-v7-27.0.2.jar
     Required by:
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-common:4.30.0
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-login:4.30.0
   > Could not find com.android.support:cardview-v7:27.0.2.
     Searched in the following locations:
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/cardview-v7/27.0.2/cardview-v7-27.0.2.pom
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/cardview-v7/27.0.2/cardview-v7-27.0.2.jar
         file:/C:/Users/Jair Acevedo/IONIC_PROJECTS/Quizionic2Evanto/Quiz_IPMA_001/platforms/android/sdk-manager/com/android/support/cardview-v7/27.0.2/cardview-v7-27.0.2.jar
     Required by:
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-common:4.30.0
   > Could not find com.android.support:customtabs:27.0.2.
     Searched in the following locations:
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/customtabs/27.0.2/customtabs-27.0.2.pom
         file:/C:/Users/Jair Acevedo/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/customtabs/27.0.2/customtabs-27.0.2.jar
         file:/C:/Users/Jair Acevedo/IONIC_PROJECTS/Quizionic2Evanto/Quiz_IPMA_001/platforms/android/sdk-manager/com/android/support/customtabs/27.0.2/customtabs-27.0.2.jar
     Required by:
         project : > com.facebook.android:facebook-android-sdk:4.30.0 > com.facebook.android:facebook-common:4.30.0

* 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 --release (exit code 1).

Error luego de abrir proyecto en Android Studio (se instalaron varias herramientas solicitadas por el Gradle):

Unable to resolve dependency for ':@debug/compileClasspath': Could not resolve project :CordovaLib.

Could not resolve project :CordovaLib.
Required by:
    project :
 > Project : declares a dependency from configuration 'debugCompile' to configuration 'debug' which is not declared in the descriptor for project :CordovaLib.

alguna idea de a que se puede deber el error?.

Saludos

11
  • Podrias poner el código de tu app.module.ts Commented el 6 feb. 2018 a las 19:45
  • agregado el app.module.ts Commented el 6 feb. 2018 a las 19:56
  • Intenta quitando el Storage de tus providers. Commented el 6 feb. 2018 a las 19:57
  • Quité el Storage Commented el 6 feb. 2018 a las 20:08
  • Uso el gradle.version=4.1 y me dice que: "JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0." ... Commented el 6 feb. 2018 a las 20:17

1 respuesta 1

2

Intenta con estos comandos:

ionic cordova platform rm android
ionic cordova platform add android
ionic cordova build android

En esta carpeta te aparecerá el apk de la aplicación (proyecto1) en mi caso. Documents\proyecto1\platforms\android\app\build\outputs\apk\debug

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.