title: muzei - FATAL EXCEPTION: IntentService[TaskQueueService]
body: <p>I'm trying to create an art source ( plugin ) for muzei. </p>
  
  <p>The app is supposed to provide a new art source which in my case is a folder of my app-private space. </p>
  
  <p>Following the example from the muzei api <a href="http://api.muzei.co/reference/com/google/android/apps/muzei/api/Artwork.Builder.html" rel="nofollow">here</a>  and the details it provides <a href="http://api.muzei.co/reference/com/google/android/apps/muzei/api/Artwork.Builder.html#imageUri%28android.net.Uri%29" rel="nofollow">here</a>  I created a FileProvider for my app.</p>
  
  <p>I have added this code to my manifest :</p>
  
  <pre><code>           &lt;provider
              android:name="android.support.v4.content.FileProvider"
              android:authorities="com.foo.bar.fileprovider"
              android:exported="false"
              android:grantUriPermissions="true"&gt;
              &lt;meta-data
                  android:name="android.support.FILE_PROVIDER_PATHS"
                  android:resource="@xml/muzei_wallpapers" /&gt;
            &lt;/provider&gt;
  </code></pre>
  
  <p>I created the xml file <code>muzei_wallpapers</code> in my res/xml folder :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;paths xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;files-path name="my_images" path="files/"  /&gt;
  &lt;/paths&gt;
  </code></pre>
  
  <p>and as you can see it points to my <code>files/</code> folder. </p>
  
  <p>And last is my class that extends <code>MuzeiArtSource</code> :</p>
  
  <pre><code>public class MuzeiService extends MuzeiArtSource {
  
  Uri imgUri;
  
  
  public MuzeiService() {
      super(MuzeiService.class.getName());
  }
  
  
  @Override
  public void onCreate() {
      super.onCreate();
     // setUserCommands(BUILTIN_COMMAND_ID_NEXT_ARTWORK); // manual switch image         
  }
  
  @Override
  protected void onUpdate(int arg0) {
  
         imgUri = muzeiContentUri();  
  
      publishArtwork(new Artwork.Builder()
             .imageUri( Uri.parse("imgUri") )
             .title("Example image")
             .byline("Unknown person, c. 1980")
             .build());       
  }
  
  
  
  public Uri muzeiContentUri()    {
      File imagePath = new File(getFilesDir(), "files");
      File newFile = new File(imagePath, "wallpaper0.png");
      Uri contentUri = FileProvider.getUriForFile(getApplicationContext(), "com.foo.bar.fileprovider", newFile);
  
      return contentUri;
  }
  
  
  
  }
  </code></pre>
  
  <p>Which seems to me the simplest example I can have returning the uri for a simple file ( named wallpapaper0 )</p>
  
  <p>When I select as resource for muzei my app I get an "unfortunately muzei has stopped" and the logcat is :</p>
  
  <pre><code>      05-28 04:29:40.350: E/AndroidRuntime(3670): FATAL EXCEPTION:      IntentService[TaskQueueService]
  05-28 04:29:40.350: E/AndroidRuntime(3670): java.lang.NullPointerException
  05-28 04:29:40.350: E/AndroidRuntime(3670):     at      com.google.android.apps.muzei.util.IOUtil.readFullyWriteToOutputStream(IOUtil.java:210)
   05-28 04:29:40.350: E/AndroidRuntime(3670):    at      com.google.android.apps.muzei.util.IOUtil.readFullyWriteToFile(IOUtil.java:202)
  05-28 04:29:40.350: E/AndroidRuntime(3670):     at      com.google.android.apps.muzei.ArtworkCache.maybeDownloadCurrentArtworkSync(ArtworkCache.java:122)
  05-28 04:29:40.350: E/AndroidRuntime(3670):     at      com.google.android.apps.muzei.TaskQueueService.onHandleIntent(TaskQueueService.java:56)
  05-28 04:29:40.350: E/AndroidRuntime(3670):     at     android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
  05-28 04:29:40.350: E/AndroidRuntime(3670):     at     android.os.Handler.dispatchMessage(Handler.java:99)
  05-28 04:29:40.350: E/AndroidRuntime(3670):     at android.os.Looper.loop(Looper.java:137)
  05-28 04:29:40.350: E/AndroidRuntime(3670):     at android.os.HandlerThread.run(HandlerThread.java:61)
  </code></pre>
  
  <p>I would really appreciate any help cause I'm stuck with it the last days and I feel like  I'm missing something simple here...</p>