Assets folder in android app (eclipse)

26,442

Solution 1

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

enter image description here

Solution 2

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

Solution 3

ProjectName/assets/fonts

Not in under the src.

Share:
26,442
Admin
Author by

Admin

Updated on October 13, 2020

Comments

  • Admin
    Admin over 3 years

    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.

  • schnatterer
    schnatterer over 7 years
    The official android developer resources tell something different, though. See also this great answer.
  • Pankaj Kumar
    Pankaj Kumar over 7 years
    @schnatterer That is different because that answer is targeted to gradle and this answer is targeted to eclipse based project.
  • schnatterer
    schnatterer over 7 years
    I couldn't figure that from the question, so I added it to the title.