Questions tagged [android-assets]

You can use the `assets` folder to store raw asset files. Files that you save here are compiled into an .apk file as-is, and the original filename is preserved. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the the AssetManager. For example, this is a good location for textures and game data.

In Android, you can use assets folder to store raw asset files. Files that you save here are compiled into an .apk file as-is, and the original filename is preserved. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the AssetManager. For example, this is a good location for textures and game data.

598 questions
13
votes
1 answer

File Logo.png does not exist in Android Studio when i try to create image asset

When I try to create action icon in Image Asset of Android Studio I saw the error log: logo.png does not exist and I can not create Action bar and Tab bar icon. Anyone can help me?
Arbaz.in
  • 1,478
  • 2
  • 19
  • 41
12
votes
4 answers

Android: Get Number of Files within Zip?

I have a question that seems easy but I cannot seem to get it to work properly. I have a zip file within my 'assets' folder that I need to unzip and I have a ProgessBar in which I want to display to the user how the progress is going. I have…
Jack
  • 121
  • 1
  • 3
12
votes
1 answer

How can I edit the text files in assets folder in Android?

I am using a text file in the assets folder in Android. I would like to change the data inside that text file dynamically. I am trying to open the file as follows: FileOutputStream…
VenkaReddy
  • 2,871
  • 2
  • 27
  • 29
12
votes
3 answers

Android NDK: read file from assets inside of shared library

In my app I have to pass a file from assets folder to shared library. I cannot do it with use of jni right now. I'm using precompiled shared library in my project, in which I have hardcoded path to my file, but I'm getting error "No such file or…
Pavel S.
  • 302
  • 1
  • 2
  • 10
12
votes
1 answer

where to place 512x512 launcher icon for google play

I've used Launcher Icon Generator to generate a simple icon. It also generates web_hi_res_512.png which is, as far I know, required size of launcher icon for publishing app at Google Play. But where should be this icon placed?
Martin Drlík
  • 1,434
  • 1
  • 14
  • 27
12
votes
1 answer

What is an Android Asset?

I'm doing my first steps in Android development, and came across the term Asset. As far as I understand it, an Asset is simply a file that is not being parsed or referensed as a resource. Is there a more accurate definition of the term? In which…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
11
votes
2 answers

Kotlin Moshi Load Json from assets

I'm trying to load an assets Json file into my project with moshi. However, i keep getting the following error: com.squareup.moshi.JsonEncodingException: Use JsonReader.setLenient(true) to accept malformed JSON at path $ How should I load the…
11
votes
1 answer

Are there any major differences or restrictions when using assets or res/raw folders?

Background Some files of the app can only be stored in res/raw or assets folders. Each of those folders work in a very similar way to the other. res/raw folder allows to access files easier, with all the other benefits of resource files, while…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
11
votes
4 answers

Attempt to invoke virtual method 'android.content.res.AssetManager android.content.res.Resources.getAssets()' on a null object reference

What is happening: I have a stacktrace from the appstore as below, problem i am facing is that it dosen't show which class has caused this crash. what i can understand is that its causing due to the assets that i have used Only place i am using…
Devrath
  • 42,072
  • 54
  • 195
  • 297
11
votes
1 answer

Android: Playing an Asset Sound Using WebView

I am trying to play a sound from the assets folder when a user clicks on an tag on my application's WebView. I found that I can use a new class extending WebViewClient to detect the extension of a link and if it is an mp3 file it can play it via…
Rangga Wiratno
  • 169
  • 2
  • 4
  • 11
10
votes
2 answers

Android notification icon is blank on some devices

I have been getting a blank/grey notification icon on some Android devices (Pixel 2 XL and Pixel 5 - both Android 11), but it shows up fine on other Android devices I tested on (Huawei P20 & P30 - both Android 10). Has anyone else come across this…
10
votes
4 answers

How to parse local JSON file in assets?

I have a JSON file in my assets folder. That file has one object with an array. The array has 150+ objects with each having three strings. For each of these 150+ objects I want to extract each string and create a java model object with it passing…
nicoqueijo
  • 872
  • 2
  • 11
  • 28
9
votes
3 answers

Copy file to assets folder

After searching 1 hour i do not found any solution to my problem. I want to move a file from sdcard to assets folder and also overwrite the existing file in assets folder (both file are sqlite database have same name with just a little difference…
Sunny
  • 14,522
  • 15
  • 84
  • 129
9
votes
5 answers

How to read a text file from "assets" directory as a string?

I have a file in my assets folder... how do I read it? Now I'm trying: public static String readFileAsString(String filePath) throws java.io.IOException{ StringBuffer fileData = new StringBuffer(1000); …
Mascarpone
  • 2,516
  • 4
  • 25
  • 46
9
votes
1 answer

Keep TensorFlow Model Encrypted on Android

I searched to understand if there is a technique to keep a trained tensorflow model (.pb file) safe in an Android app but didn't find anything useful. I am releasing an app containing a tensorflow model which I built on a training set. When I…
1 2
3
39 40