Nativescript build failed - android

I'm trying to get my app on an android device. When I run
tns run android
I get this error :
/Users/coreelements/Projects/nativescript/myapp/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:32: AAPT: error: resource
drawable/icon (aka nl.coreelements.myapp:drawable/icon) not found.FAILURE: Build failed with an exception.* What went wrong:
Execution failed for task ':app:processDebugResources'.
Failed to process resources, see aapt output above for details.
I've already tried regenerating the app and splashes :
tns resources generate icons src/images/appicon.png
tns resources generate splashes src/images/appicon.png
What am I missing? I've also tried to buid/run in App Studio.

Just wrapping up the answer from #fransyozef:
App_Resources/Android/src/main/AndroidManifest.xml should point to the right drawable, in this case replacing android:icon="#drawable/icon" with android:icon="#drawable/appicon" solved the issue.

The solution above did not work for me, what did work is change
android:icon="#drawable/icon" to android:icon="#drawable/fileName", so replace /icon with /fileName of the image that is stored there.

Related

How can I resolve the Android Studio Build Output error

Trying to build the app but have got the error: The error Confugure image asset1
Confugure image asset2
Confugure image asset3
ERROR:C:\Users\Alex\AndroidStudioProjects\Lm2\app\src\main\res\mipmap-anydpi-v26\ic_launcher_round.xml:3: AAPT: error: resource mipmap/ic_launcher_background (aka com.example.lm2:mipmap/ic_launcher_background) not found.
How can I resolve this?
I hope you have
put your launcher icons into the mipmap folder where they should always go.
added your adaptive icon to the app’s manifest.xml for “android:icon” (android:roundIcon) attribute
.
Fist hand try: Clean your project and Rebuild
Probable Issue reason: Malformed XML:
Solution:
Check if you have anything duplicated by mistake in your XML
Try Analyze > Inspect Code it will redirect you to the exact error.

flutter Android resource linking failed #mipmap/ic_launcher not found

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
E:\Programs\Flutter\<My_APP>\build\app\intermediates\packaged_manifests\debug\AndroidManifest.xml:16: AAPT: error: resource mipmap/ic_launcher (aka com.example.<My_APP>:mipmap/ic_launcher) not found.
I try to removing icon from android manifest file it works but, I want flutter ic_launcher. Any idea, what is the cause ?
In case you've switched your app icon not only in terms of the image but also the name of it then you also need to change the icon name in the AndroidManifest.xml.
android:icon="#mipmap/'Your icon_name'">
it clearly says icon not found you need to either change name or rename your existing icon as ic_launcher
It happent because your launcer icon name and android_manifest icon name different.
first of all goto .....\android\app\src\main\res\mipmap-hdpi
then check the name of your icon is it is ic_launcer
then go to android>app>src>AndroidManifest.xml
Change
android:icon="#mipmap/your_icon_name"
I reinstall flutter and now it's works

Jenkins - Execution failed for task ':app:mergeDebugResources'

I am trying to work with Jenkins however I cannot build the apk with it as I am having issue with AAPT2 and Gradle.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Multiple task action failures occurred:
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\b478eb984dbbd1317dab9bfd9689b3aa\transformed\appcompat-1.3.0\res\drawable-hdpi-v4\abc_list_divider_mtrl_alpha.9.png: AAPT: error: file not found.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\b478eb984dbbd1317dab9bfd9689b3aa\transformed\appcompat-1.3.0\res\drawable-xhdpi-v4\abc_list_divider_mtrl_alpha.9.png: AAPT: error: file not found.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-3\b478eb984dbbd1317dab9bfd9689b3aa\transformed\appcompat-1.3.0\res\drawable-mdpi-v4\abc_list_divider_mtrl_alpha.9.png: AAPT: error: file not found.
I already read tons of SO question that may share same issue to my case saying that it has something to do with the file path being too long but I still cannot find any solution.
UPDATE
I tried to change Android Studio Gradle home similar to what Jenkins is using and received similar error which indicates that it may really have something to do with long file path.
I think the final question will be how to change Jenkins Gradle Home?
You need to replace \ with \\ if you are giving path with jenkins in Windows.
May be if file path is too huge or that is the root cause you can try mounting the directory to a short path
EDIT : Based on your modified question :
Open Jenkins dashboard. Navigate to Manage Jenkins-> Configure System. Under the Global properties section add another environment variable named GRADLE_USER_HOME as shown below.
I ran into this exact issue, but unfortunately changing the GRADLE_USER_HOME environment variable did not help, as aapt2 appeared to ignore the change and still used Windows/system32/... for the cache location.
The problem was how I was running Jenkins as a service. In the service.msc settings, it was set to Log On as a Local System account, which set the USER_HOME variables to C:\Windows\System32. Because of this, the reason the error said that the file did not exist was because Jenkins/gradle did not have access to the System32 folder.
My fix was to change the log on method to 'This account', then enter a user account so Jenkins wasn't logged on as system anymore.

Ionic 3 AAPT error after gradle update: resource fontVariationSettings not found

The problem is that since this morning (I believe, I have not worked yesterday) when I try to run my ionic 3 application on the device I get an AAPT error.
To recreate the problem I started from a scratch app.
I create a simple new ionic application:
ionic start gradleError tabs
Now if I try to run it on my device it works
Let's say I want to add this plugin using simply this two commands:
ionic cordova plugin add cordova-plugin-mauron85-background-geolocation
npm install --save #ionic-native/background-geolocation
Now when I try to run it on my device I get the following Errors:
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Reading the error output is seems that the problem is this one:
fontVariationSettings not found.
ttcIndex not found.
First fix attempt was made by changing inside "platforms/android/project.properties" the line into:
cordova.system.library.2=com.android.support:support-v4:26+
After trying to run in on device I start to get a bunch of errors which looks like:
/Users/zeno/Desktop/Bachelor/App/gradleError/test/platforms/android/app/src/main/java/com/tenforwardconsulting/cordova/BackgroundGeolocationPlugin.java:563: error: cannot find symbol
#TargetApi(Build.VERSION_CODES.KITKAT)
^
symbol: variable KITKAT
location: class VERSION_CODES
/Users/zeno/Desktop/Bachelor/App/gradleError/test/platforms/android/app/src/main/java/org/apache/cordova/splashscreen/SplashScreen.java:297: error: cannot find symbol
LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
^
symbol: variable MATCH_PARENT
With ate the end:
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Now following what has been said on the ionic forum I tried to run the following command:
cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=27.0.0
with which I get the same errors as the change I made before.
I tried also to play with the system and the numbers, from 27 to 27.1 to 24 and so on, nothing changed.

No matching client found for package name 'org.apache.cordova'

I'm creating a simple Cordova application (android/iOS) that makes use of Azure services such as authorisation and push notifications.
I've run into an error that I have not managed to fix. When building the app I get the following error:
Error: /*path*/ Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':CordovaLib:processDebugGoogleServices'.
> No matching client found for package name 'org.apache.cordova'
The package name in config.xml, google-services.json, and AndroidManifest.xml are all the same, excluding in android/CordovaLib/AndroidManifest.xml (in which it is org.apache.cordova). When I try changing this a bunch of other errors arise.
I've redownloaded the google-services.json file and tried any solutions I found online, however nothing has worked.
Any help would be highly appreciated!

Categories

Resources