I need to add some files to my android/assets folder of my project however, it isn't there ? I may have accidentally deleted it without knowing.
how do I create the assets folder?
Android studio doest provide ASSETS folder by default
you have to create it from
For the Android plugin, extra files and folders specific to Android:
AndroidManifest.xml
res/
assets/
aidl/
rs/
jni/
jniLibs/
Please read where to place asset folder
Related
I have created 2 directories in the assets folder.
One is android and second is window.
--assets
1:- android
2:- window
I have a few files inside in the android folder. I need to copy all of them from the android folder to the window folder at runtime. How do I do it?
You can't. The assets folder is read-only and cannot be modified after compilation.
You can copy your files into a similar structure on the internal storage if you wish to do so.
I'm trying to copy and paste a whole bunch of files/folders into my Assets folder (that I created in the Main folder by selecting New > Folder > Assets Folder). But I get this error:
Cannot create class-file
The file in question is GUIDemo.class but there are others like it, too. Any suggestions how I can copy and paste the assets files into my project?
Android Studio uses Gradle-based build system, you should
putting assets/ inside of the source sets (e.g., src/main/assets/)
or create a folder under res
Try right click your app -- New -- Folder-- Assets folder
Change Android tag to Project, right click src --- make module app
I am developing a cross-platform project(iOS and Android).
I have a /resource folder that contain some .png files.
I know that only the files that in /asset folder are compiled into the .apk file.
Now I need copy the files from /resource to /asset folder manually.
It is too inconvenient.
Is is possible to copy files in /resource to /asset during build project automatically?
(p.s. I am using Eclipse for development.)
I had searched to create the assets folder in an android app, the solution which i had tried is <App Name>/src/assets/fonts/
but when i try to use a ttf file in my Application, i have an error :
the code :
mFace = Typeface.createFromAsset(mContext.getAssets(),"fonts/fontType.ttf");
and the error :
native typeface cannot be made
I don't know if the assets folder is in the good place.
The problem is at the path of asset
<App Name>/src/assets/fonts/
should be
<App Name>/assets/fonts/
Read more at Directory Structure of an Android Project
Android project directory structure is as below
In Android Studio, I tried the root "app" folder, and that didn't work. I looked for the AndroidManifest.xml file and put the assets folder there. That worked for me.
For me it ended up being app\src\main\assets
ProjectName/assets/fonts
Not in under the src.
The assets folder is an independent folder.
While creating an Android project itself the Assets folder is independent to the src folder. Not inside the src folder.
Confirm that assets folder was created in the following way /assets.
Later create a fonts folder inside the assets folder and place fonts file inside the fonts : /assets/fonts
I'm pretty new to eclipse and Android and I'm trying to add some files to the assets folder, but certain files and directories are not being included in the .apk file.
I have set-up the following structure in the solution:
/assets
/textures
/test.png
/splash.png
/xml
/testData.xml
I don't know if there is a specific way to get eclipse to re-build/compile the project and add the new assets to the assets folder in the .apk, but the /xml subfolder (and its contents) are not in the apk. Subsequently I get FilenotFoundExceptions thrown when I deploy the app. The textures are all included.
How can I force a recompile and rebuild of the apk and is there anywhere to manually check which files are included in the project (like an assets manifest file)?
As far as I know there are no restrictions placed on hierarchy or file formats for within the assets folder. Also, when I dragged the files from the desktop to the solution explorer, I selected 'copy files to project'.
Thanks
It appears one cannot use upper-case letters in the naming of files within the assets folder. Contrary to my example above, I was actually using camel-backed file names within the folders. After changing the file names to lower-case, the apk was automatically re-built with the assets the next time I deployed