Home > OS >  Appropriate Paths for Resources in AndroidManifest.xml
Appropriate Paths for Resources in AndroidManifest.xml

Time:05-10

in my AndroidManifest.xml, I have

<application
    android:icon="@drawable/iC_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

And when I run gradle build, I keep getting the errors

resource drawable/ic_launcher (aka com.example.MyProject:drawable/ic_launcher) not found
resource string/app_name (aka com.example.MyProject:string/app_name) not found
resource style/AppTheme (aka com.example.MyProject:style/AppTheme) not found

I'm guessing that the @drawable @string and @style correspond to the directories with the same names I've seen before when I used Android Studio. But now that I don't use Android Studio anymore, where should I put them? Currently my Java files are located in

app/src/main/java/MyProject

and my AndroidManifest.xml file is located in

app/src/main/AndroidManifest.xml

The directories are generated via gradle init; do I need to rearrange them?

CodePudding user response:

I'm guessing that the @drawable @string and @style correspond to the directories with the same names I've seen before when I used Android Studio

There is no style directory and there is no string directory. Style and string resources go in a values directory.

But now that I don't use Android Studio anymore, where should I put them?

The same place that Android Studio puts them, and the same place that they are in any Android project. For a module named app and a source set named main, you would create subdirectories under app/src/main/res for different resource types and resource sets.

FWIW, this free book of mine explains all of this.

  • Related