Android app is displaying an old image that was replaced - android

I am adding some icons from the drawables folder to a layout. I had an image that I replaced which got the same name as the old one. I have overridden the file, rebuilt the project and the Android Studio's graphical layout showed the new icon. However, when I ran the app, the old icon appeared. I went over all the drawables folders to see if there might be one with the old icon, but it was replaced in every folder. I also tried reinstalling the app and it's still showing the wrong icon.
Why won't the app show the correct icon?

May be due to some bug of Android Studio, Try it out it will work :
Delete .apk from local path manually (Path : \YourProjectFolder\app\build\outputs\apk\app-debug.apk)
then Rebuild Project and finally Run it.

Because of instant run feature,
Once your app is installed, Instant Run allows you to push code changes without building a new APK
new apk is not creating. Try after deleting apk file from path ...\apk\app-debug.apk
Then build and generate apk again.

Rebuild Your Project then it works fine

Delete your icon from the drawables folder, set another image in the application instead of the deleted one, run the application, close the application, add your image again in the drawables folder, add it on your control and run again. It should work now.

What eventually happened is that the images were replaced in a library module, while the app module also contained the old image. Since the app resources overrides the library's resources, the old image was shown.

Related

NativeScript 8.0.4 Android App Icon WILL NOT Change from default

I'm tearing my hair out over here. I've developed applications with earlier versions of nativescript and this has never been issue... This is my last effort before I just downgrade to an older version
I have ran the command tns resources generate icons ../icon.png and it claims to have successfully generated the icons and I can see them in the directory... build and deployed to phone. Still has the default nativescript icon
I went to App_Resources/Android/src/main/res and manually updated the ic_launcher.png file in every mipmap directory... build and deployed to phone, same result! Default icon
Tried deleting the platform/android directory and rebuilding. No luck
I searched from the root directory and I cannot figure out how the heck this default icon is appearing still!!!
Note: I was able to change the splash screen
Any help... please, thank you
I ended up solving this issue eventually, so for anyone this might help in the future... In the newer versions of NativeScript there is now a new folder in res called "mipmap-anydpi-v26" which uses vector graphics. If your on SDK 26+ it will automatically use this vector graphic and IGNORE every other PNG icon in all the other folders.
Your options to remedy this are either:
A) Delete this folder from the directory, which will force it to fall back to the regular PNG icon that's appropriate for the device resolution
B) Edit the file in the folder and update the SVG to use yours
I had a similar issue on nativescript 8.1.1, nativescript/android 8.1.1 with svelte 3.44.0. After running ns resources generate icons <icon-path> and ns resources generate splashes <splash-path>as show in this stack post here. Only the splashes were generated successfully. However the icons didn't work as described, hence I had to generate my app launcher icons using this service. Then I downloaded the zip file, unzipped it and copied the contents of the 'res' directory in the unzipped file to <project-directory>/App_Resources/Android/src/main/res to replace all the directories with the same names (i.e. mipmap-anydpi-v26, mipmap-hdpi etc). Then rebuilt and reran my application and everything worked fine.
Since 8.x Nativescript ships with the adaptive icons - since the old icons are outdated on more recent android phones, and usually look weird
1.Open a project in Android Studio and in the Project Explorer pane right-click on the app directory or any of the directories inside the app directory. In the context menu that opens select New > Image Asset
2.Once Asset Studio opens you'll see the new default app icon
3.The main thing to know about adaptive icons is that there are two layers, a foreground and background. The default foreground will be titled ic_launcher_foreground.xml and it is an SVG. Go ahead and click the ... button next to the path (image below) and select your app icon that you're going to use.
4.Now you can go ahead and set the other settings for your icon such as trim and the resize percentage. You'll also be able to change the default green background layer, select the Background Layer tab and you can repeat the same process. From experience, in a lot of cases you can use the Color radio button to set the color you'd like to use for your background layer.
5.Once you are finished with your icon configuration you can complete the wizard which will generate the various resources needed for your app. The new files will be located under the android app directory in src/main/res/ where you should see several mipmap- directories.
6.Now move all the files in mipmap- directories to your Nativescript's App_Resources mipmap folder
7.Once you have copied over the newly created icon files to the NativeScript project there is one final change you need for your application. The only change is to set the android:icon value to #mipmap/ic_launcher which is the resource location of the new files we added from the Android project from Android Studio.
Hope this helps to solve your issue
I always use NativeScript Sidekick to generate my icons. I don't know if that will yield different results from the tns command, but at least it's something else to try.

Flutter Android launcher icon looks very small

I'm using the flutter_launcher_icons package to generate launcher icons for both Android and iOS. Everything looks great on iOS, but on Android the icon looks very tiny:
It's the second one from the left. I've tried all kinds of things to get it to be bigger. I've tried several different source images to generate the icon, 512x512 and 900x900, but no matter what I do I can't get it to generate an icon as large as the others. I'm sure I'm missing something stupid here. This is my flutter_launcher_icons config:
flutter_icons:
android: true
ios: true
image_path: "assets/icon/icon_new2.png"
I would recommend you to use http://romannurik.github.io/AndroidAssetStudio/icons-launcher.html to generate your launcher icon : you'll be able to reduce padding to get an icon as big as possible. When you hit download, this will generate a zip archive containing a res folder with a subfolder for each size.
Let's then put manually the Android launcher icon :
In your config, put android: false so the flutter_launcher_icons plugins stops generating icons for android, and paste your generated subfolders in yourproject/android/res
I encountered the same issue as you, looks like we followed the same tutorials/links.
EDIT : If you still encounter issues, this thread may help you (almost a duplicate) App Icon on Device is too small
For all the flutter android projects, for those who are still facing issues after generating icons from here, http://romannurik.github.io/AndroidAssetStudio/icons-launcher.html follow the below steps,
Open your flutter project in Android Studio
Select the android folder and Right click
Select the option flutter->Open Android Module in Android Studio ( open in new window)
It will take a while, once its done, in the android project, right click on res->drawable folder, and create new image asset
Create the launcher icons using your image in this android studio wizard.
Once the launcher icons are created, build your apk or app bundle asusual from your flutter project. It should work fine now.
To complement the answer of the user TBG, in my case, the path where I had to put the res folder was in youproject/android/app/src/main/, replace what you have and voila, recompile your project.

Replaced image in Android project, but won't update in the app

I have an Android project, and I wanted to replace two of the images I use in it with updated ones. So, with Eclipse i just delete the old one and replace it with new one with same name. Then i refresh the project.When i see this in drawable folder it was replaced but when i run this project it was still showing old image in my app.
Please let me know the solution.This is very urgent.
First make sure you have replaced the image(s) in all drawable-* folders. If that is the case, doing Project->Clean (and selecting your project) in Eclipse after the refresh of the project files should do the trick. Also, before re-deploying on the device, uninstall the previous version of the app.

Changed resource image with another, recompiled, but the old image still appears

Did anyone face such a situation: you change a resource image with another image of the same name (for ex, btn.png with other btn.png), you then recompile the project and load the app into a mobile phone or emulator, but the old image still appears?
I do not know how to solve this issue. I tried uninstalling the app from the device, and installing the changed one, but new image still does not appear.
I know that I can choose a new filename and it will work, but how to force resource rebuilding?
PS. I realized that you can rebuild the project manually, so if anyone has a better solution (and faster), please let me know.
Unfortunately, it seems that in case when you replace one image with another of the same name, you have to rebuild the project as it will only trigger resources rebuilt.
I've tested different ways, and project rebuild was the only command which remapped PNG files in the resources folders.
I had faced this problem.Try doing all these this
1.Checkout all the resource folders and make sure the earlier image does not exist in any of the folders.
2.Try checking the name of the new image and check weather is same as to that of the earlier ones.
3.Try uninstalling the app after clearing all the data from the emulator or phone. Hope making all these stuff sure will solve this problem.I got it ryt by doing all these.
4.Also try runing the project after clearing the bin and gen folder in your project
.
Make sure your image in the resource folder is replaced by new image . In that case it must show new image after you do a clean build.

Android Setting Background

I'm trying to change the background of my first app to a png I have. I put the png in a newly created folder called "drawable." When I go to browse my "drawable" I can't see it's "children" or files. The only error of sorts that it gives me is "You must... rce item" anyone run into this? Android API 7 by the way.
Put the png in /res/drawable and then do a clean on your project in eclipse to force the .R class for your app to be recreated. You might also need to do an f5/refresh in eclipse on the project to get it to see that you have added a file in filesystem to /res/drawable.

Categories

Resources