Reputation: 105
I recently moved from a Linux to windows environment and I'm having issues building an ionic app successfully. Ionic Cordova build android stops at
:app:splitsDiscoveryTaskDebug UP-TO-DATE
it seems a plugin (cordova-plugin-paystack) is the cause because it builds fine without errors when I run build with this plugin removed.
here's the error code:
: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
C:\Users\Erondu Emmanuel\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\2a476605aeb8db0b92c43b3475268151\res\values\values.xml:251:5-69: AAPT: error: resource attr/foreground (aka com.kekerides.user:attr/foreground) not found.
C:\Users\Erondu Emmanuel\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\2a476605aeb8db0b92c43b3475268151\res\values\values.xml:251:5-69: AAPT: error: resource attr/foregroundGravity (aka com.kekerides.user:attr/foregroundGravity) not found.
C:\Users\Erondu Emmanuel\Documents\DEVELOPMENT\User\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:577: error: resource attr/foreground (aka com.kekerides.user:attr/foreground) not found.
C:\Users\Erondu Emmanuel\Documents\DEVELOPMENT\User\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:577: error: resource attr/foregroundGravity (aka com.kekerides.user:attr/foregroundGravity) not found.
error: failed linking references.
npm version:6.4.1 nodejs :8.12.10 ionic: 5.1.0 cordova :8.0.0
I have tried the instructions here Cordova Android error :app:transformClassesWithDesugarForDebug when adding plugin and it still doesn't work.
Upvotes: 2
Views: 1796
Reputation: 11
Update: For those who are still having this issues after doing as Emmanuel has instructed, do this: there are two Values folders in your app directory. add the above code in both and the error will be gone. But if you are using an older version of android studio, you should have only one.
Myappname\app\src\main\res\values AND Myappname\app\src\main\res\values-21
Upvotes: 1
Reputation: 105
After trying for over 24hrs, I stumbled upon a thread on the Paystack GitHub page here : https://github.com/PaystackHQ/paystack-android/issues/33.
solution: I created a file named attr.xml in Myappname\platforms\android\app\src\main\res\values\ and added the following code:
<declare-styleable name="ForegroundView">
<attr name="foreground" format="color" />
<attr name="foregroundGravity" format="integer" />
<attr name="foregroundInsidePadding" format="boolean" />
</declare-styleable>
and build was successfull! How do i preserve this file when i run
cordova platform add android
hopefully this will help someone else in future.
Upvotes: 6