6

I am trying to develop in android-studio on MAC and I am coming across a weird problem. Within the activity code I can not refer to an image which lies in the mipmap folder. In particular I am have created a notification as:

...

Notification notify = new NotificationCompat.Builder(this)
    .setContentTitle(title)
    .setContentText(body)
    .setSmallIcon(R.drawable.ic_launcher)
    .setContentIntent(startPendingIntent)
    .build();

...

and I receive the error "cannot resolve symbol ic_launcher". Strange is also the problem, that I can not copy-paste the icons into the drawable folder which is empty. Where and how should I place the icons in order to visible within the code in android studio?

Setu Kumar Basak
  • 11,460
  • 9
  • 53
  • 85
arjacsoh
  • 8,932
  • 28
  • 106
  • 166

2 Answers2

15

You need to access the drawable using R.mipmap.ic_launcher

freddieptf
  • 2,134
  • 2
  • 15
  • 16
1

Close Android Studio, then open up finder. Go to the project directory. Go navigate to your project's mipmap folder. Copy the images, then go to the drawable folder and paste the images in their respective resolution folders. Open up android studio again and they should be in the drawable folder.

Bobby
  • 1,416
  • 1
  • 17
  • 30
  • I have also the problem that the respective resolution folders do not exist (by the creation of the project). This is hence my principal problem How can I create them? New Image asset? Or merely new folder? – arjacsoh Mar 17 '15 at 09:37
  • All you would need to do is create the new folders in the drawable folder using finder and place the image assets in their respective folders. – Bobby Mar 17 '15 at 14:03