Is it still possible to build a Ionic V1 app?

Hello everybody,

I am getting a bit desperate because I am struggling for days to build a two years old app made with the first version.
I am facing many errors, certainly due to my development environment changes since the development time. Now the client is asking for some changes on the app, and it seems to be completely broken in my dev environment. I have the same code than the one in production.
I tried to launch the app with ionic cordova run android and the command stops with this log :

[WARN] Not performing Ionic build for project type: ionic1.
> cordova run android
Unsupported global orientation: portrait/portrait. Defaulting to value: default

Running command: "/Users/me/myapp/hooks/after_prepare/010_add_platform_class.js" "/Users/digeek/me/myapp"

add to body class: platform-android
Attempting to set app name
Setting App Name:  MyAppName
(node:8879) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
(node:8879) UnhandledPromiseRejectionWarning: CordovaError: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
    at /Users/me/myapp/platforms/android/cordova/lib/check_reqs.js:45:27
    at ChildProcess.exithandler (child_process.js:279:5)
    at ChildProcess.emit (events.js:159:13)
    at maybeClose (internal/child_process.js:943:16)
    at Socket.stream.socket.on (internal/child_process.js:363:11)
    at Socket.emit (events.js:159:13)
    at Pipe._handle.close [as _onclose] (net.js:568:12)
(node:8879) 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:8879) [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.

[OK] Your app has been deployed.
     Did you know you can live-reload changes from your app with --livereload?

I also tried to install ionic@1.3 on a clean environment, but it keeps failing with ENOENT and ENOPACKAGEJSON errors.

That’s why I am wondering if it is still possible to build Ionic V1 app, with an up to date environment ? (I mean nodeJS, Android and JAVA SDK etc)

Yep, it is perfectly doable.

ionic is Ionic CLI, not the “Ionic Framework” you use in your app. So by installing ionic@1.3 you just chose a super old CLI that does definitely not work with current tooling and mobile OS versions.

You should install the newest CLI, then run ionic info and post here what you got back in your project.

Here is my ionic info

cli packages: (/Users/me/.nvm/versions/node/v9.3.0/lib/node_modules)

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

global packages:

    cordova (Cordova CLI) : 8.0.0 
    Gulp CLI              : CLI version 3.9.1 Local version 3.9.1

local packages:

    Cordova Platforms : android 7.0.0
    Ionic Framework   : ionic1 1.3.1

System:

    Android SDK Tools : 26.1.1
    Node              : v9.3.0
    npm               : 5.8.0 
    OS                : macOS High Sierra
    Xcode             : Xcode 9.2 Build version 9C40b 

Environment Variables:

    ANDROID_HOME : /usr/local/share/android-sdk

That doesn’t look too bad!

Your Cordova tooling seems to be out of date, which might be causing all kinds of problems.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: How to update Cordova CLI, Platforms and Plugins ¡ ionic.zone (Cordova Android currently is 7.1.0)

What does ionic cordova requirements return?

Wow that looks a little bit weird when I check requirements :s

> cordova requirements

Requirements check results for android:

Java JDK: installed .
Android SDK: installed 
Android target: not installed 
Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.

Gradle: not installed 
Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: /usr/local/share/android-sdk/tools/templates/gradle/wrapper


Requirements check results for ios:
Apple OS X: installed darwin
Xcode: installed 9.2

ios-deploy: not installed 
ios-deploy was not found. Please download, build and install version 1.8.3 or greater from https://github.com/phonegap/ios-deploy into your path, or do 'npm install -g ios-deploy'

(node:9194) UnhandledPromiseRejectionWarning: CordovaError: Some of requirements check failed
    at /Users/me/.nvm/versions/node/v9.3.0/lib/node_modules/cordova/src/cli.js:414:27
    at _fulfilled (/Users/me/.nvm/versions/node/v9.3.0/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/Users/me/.nvm/versions/node/v9.3.0/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/Users/me/.nvm/versions/node/v9.3.0/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:749:13)
    at /Users/me/.nvm/versions/node/v9.3.0/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:557:44
    at flush (/Users/me/.nvm/versions/node/v9.3.0/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:108:17)
    at process._tickCallback (internal/process/next_tick.js:150:11)
(node:9194) 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:9194) [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.

I am going to try to update cordova right now

Do you have Android Studio installed?

Yes for sure, but I have the feeling that there is some issues with the Android Path. With other android projects, I very often need to run export ANDROID_HOME=/usr/local/share/android-sdk to be able to build.
Unfortunately, even with this command I still cannot run my old project with Ionic.

You might want to know that I am able to create Ionic 1 projects and run them. The problem seems to be very specific to my old project.

What you need to have installed is dependant on the Cordova-Android version you have installed. As I wrote before, go with 7.1.0 and then install Android Studio 3 and maybe a standalone gradle. Then the ionic cordova requirements command should be happy (or you might have to set a few ENV variables that it tells you until it is).

Ionic v1 itself really is not connected to that in any way to be honest. This is just Cordova and your system environment.

Okay, so right now I have Cordova Platforms : android 7.1.0 ios 4.1.1, and Android Studio 3.0.1, an update is available for the 3.1.1, but I don’t think it’s useful to solve this.

Requirements check results for android:

Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-27,android-26,android-25,android-24,Google Inc.:Google APIs:24,android-23,Google Inc.:Google APIs:23,android-22,Google Inc.:Google APIs:22,android-21,Google Inc.:Google APIs:21

Gradle: installed /usr/local/Cellar/gradle/2.12/libexec/bin/gradle

Still errors building my app :frowning:

[WARN] Not performing Ionic build for project type: ionic1.
> cordova run android
Android Studio project detected

Running command: /Users/me/myApp/hooks/after_prepare/010_add_platform_class.js /Users/me/myApp

Attempting to set app name
ANDROID_HOME=/usr/local/share/android-sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
studio
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
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_5f5814c5hf12eppck1msl2b59.run(/Users/me/myApp/platforms/android/app/build.gradle:144)
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript
 UP-TO-DATE
:CordovaLib:checkDebugManifest UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:prepareLintJar UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:platformAttrExtractor UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources
 UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:javaPreCompileDebug UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugAidl UP-TO-DATE
:CordovaLib:packageDebugRenderscript
 NO-SOURCE
:app:compileDebugRenderscript UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig
 UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
 UP-TO-DATE
:app:mergeDebugResources
 UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResources
/Users/me/myApp/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:46: AAPT: error: 'portrait/portrait' is incompatible with attribute android:screenOrientation (attr) enum [behind=3, fullSensor=10, fullUser=13, landscape=0, locked=14, nosensor=5, portrait=1, reverseLandscape=8, reversePortrait=9, sensor=4, sensorLandscape=6, sensorPortrait=7, unspecified=4294967295, user=2, userLandscape=11, userPortrait=12].
    
/Users/me/myApp/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:46: error: 'portrait/portrait' is incompatible with attribute android:screenOrientation (attr) enum [behind=3, fullSensor=10, fullUser=13, landscape=0, locked=14, nosensor=5, portrait=1, reverseLandscape=8, reversePortrait=9, sensor=4, sensorLandscape=6, sensorPortrait=7, unspecified=4294967295, user=2, userLandscape=11, userPortrait=12].
error: failed processing manifest.

Failed to execute aapt

com.android.ide.common.process.ProcessException: Failed to execute aapt

	at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
	at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
	at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)

	at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)

	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)

	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)

	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)

	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)

	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)

	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)

	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)

	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)

	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)

	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)

	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)

	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)

	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)

	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)

	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)

	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)

	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
	at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
	at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
	at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
	... 41 more
Caused by: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
	at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
	at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
	at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$makeValidatedPackage$1(QueueableAapt2.java:179)
Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
	at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:463)
	at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:415)
	at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
	at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt

* 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 1s
 FAILED
25 actionable tasks: 1 executed, 24 up-to-date
(node:11365) UnhandledPromiseRejectionWarning: Error: /Users/me/myApp/platforms/android/gradlew: Command failed with exit code 1 Error output:
/Users/me/myApp/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:46: AAPT: error: 'portrait/portrait' is incompatible with attribute android:screenOrientation (attr) enum [behind=3, fullSensor=10, fullUser=13, landscape=0, locked=14, nosensor=5, portrait=1, reverseLandscape=8, reversePortrait=9, sensor=4, sensorLandscape=6, sensorPortrait=7, unspecified=4294967295, user=2, userLandscape=11, userPortrait=12].
    
/Users/me/myApp/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:46: error: 'portrait/portrait' is incompatible with attribute android:screenOrientation (attr) enum [behind=3, fullSensor=10, fullUser=13, landscape=0, locked=14, nosensor=5, portrait=1, reverseLandscape=8, reversePortrait=9, sensor=4, sensorLandscape=6, sensorPortrait=7, unspecified=4294967295, user=2, userLandscape=11, userPortrait=12].
error: failed processing manifest.

Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
	at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
	at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
	at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
	at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
	at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
	at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
	at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
	... 41 more
Caused by: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
	at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
	at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
	at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$makeValidatedPackage$1(QueueableAapt2.java:179)
Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
	at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:463)
	at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:415)
	at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
	at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt

* 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 1s
    at ChildProcess.whenDone (/Users/me/myApp/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at ChildProcess.emit (events.js:159:13)
    at maybeClose (internal/child_process.js:943:16)
    at Process.ChildProcess._han
dle.onexit (internal/child_process.js:220:5)
(node:11365) 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:11365) [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.

[OK] Your app has been deployed.
     Did you know you can live-reload changes from your app with --livereload?

Do you have portrait/portrait somewhere in your config.xml? Android doesn’t seem to like something here.

Yes indeed my orientation was set on portrait/portrait, I don’t know why this is a problem today and was not before.
Thus I also had to tweak some other settings in the config.xml to get this running, but this is finally ok !
There are though some things broken now in my app, I hope this is not plugin incompatibilities due to Ionic updates :confused: I think I can handle it, but I will keep in touch if I am facing complicated issues.

Anyway, many thanks for your precious help ! :slight_smile:

1 Like

Probably you are now using a different Cordova Android or targeting another Android version. Maybe also some of the Cordova tooling changed in the mean time. It’s all pretty much a moving target.

Ionic doesn’t really care - it’s is “just” the web app running inside the webview - , but Cordova or the native tooling maybe does.

Yippieh!

Kepp us updated.

Hi, I still have an annoying bug due to plugins (making my app unable to run correctly).
There is ‘phonegap-plugin-push@1.7.2’ in my app, the plugin is correctly referenced in config.xml, present in the plugin folder, listed when running ionic cordova plugin list. But the app keeps throwing this error : Ionic Push: PushNotification plugin is required. Have you run ionic plugin add phonegap-plugin-push ?

I obviously tried to run this, but nothing particular happens, except breaking my build forcing to remove and add android platform, but the error is still here after that …

How are you using the push plugin?

Uh I’m not sure what you meant by how do I use it, but I guess it is about the code involved, so here it is :

angular.module('starter', ['ionic', 'ngCordova', 'ngStorage', 'ngSanitize', 'ionic.service.core', 'ionic.service.push', 'starter.services', 'starter.controller.home', 'starter.controller.list', 'starter.controller.single', 'starter.controller.gallery', 'starter.controller.news', 'starter.controller.offers', 'starter.controller.docslist'])

.run(function($ionicPlatform, $rootScope, $ionicModal, $state, $timeout, $ionicHistory, $localStorage, NetworkService, WebService, RubriqueService, News, $ionicPopup) {
  $ionicPlatform.ready(function() {

      //Notification push
      var push = new Ionic.Push({
          "debug": true,
          "badge":true,
          "sound":true,
          "vibrate":true,
          "title":true,
          "clearBadge":true,
          "onNotification": function(notification) {
              var payload = notification.payload;
              console.log(notification);
              console.log(notification._raw);

              var showConfirm = function() {
                 ...
              };
          },
          "onRegister": function(data) {
              console.log(data.token);
          },
          "pluginConfig": {
              "ios": {
                  "badge": true,
                  "clearBadge":true,
                  "sound": true
              },
              "android": {
                  "badge": true,
                  "clearBadge":true,
                  "iconColor": "#343434"
              }
          }
      });

      var callback = function(token) {
          ...
      };

      push.register(callback);

      ...

This might be relevant then: https://ionicframework.com/docs/pro/migration/push.html

Okay great … :sob: I am going to give it a try