title: How to prevent Gradle from compressing .txt files?
body: <p>I have the following configuration: a <code>FileProvider</code> from one application that provider other application files of type <strong>drawables</strong> and other text files that contain <strong>json</strong> structure.</p>
  
  <p>Now all this configuration work and I receive a <strong>content uri</strong> (content://...) from one application at the other for both types of files.</p>
  
  <p>What I don't know is how can I recognize on the receiver application what type of file it's received (<strong>drawable</strong> or <strong>json</strong> .txt) and how to convert properly the uri to one of this file types.</p>
  
  <p>This is the current activity of the receiver application:</p>
  
  <pre><code>public class MainActivity extends Activity {
  
  ListView listView;
  Cursor cursor;
  Button bShowImageFiles, bShowJsonFiles;
  Context mContext;
  
  //TODO: Densities
  static final String DENSITY_LOW = "ldpi";
  static final String DENSITY_MEDIUM = "mdpi";
  static final String DENSITY_HIGH = "hdpi";
  static final String DENSITY_XHIGH = "xhdpi";
  static final String DENSITY_XXHIGH = "xxhdpi";
  
  public static final String FILES = "video";
  public static final String PROVIDER_AUTHORITY = "some.authority";
  public static final Uri CONTENT_URI = Uri.parse("content://" + PROVIDER_AUTHORITY + "/");
  public static Uri FILES_URI = Uri.parse("content://" + PROVIDER_AUTHORITY + "/" + FILES  + "/");
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      mContext = this;
      bShowImageFiles = (Button) findViewById(R.id.bShowImageFiles);
      bShowJsonFiles = (Button) findViewById(R.id.bShowJsonFiles);
      listView = (ListView) findViewById(R.id.listView1);
  
      final String[] from = { "_id", "fileName" };
      final int[] to = { R.id.textViewID, R.id.textFileName };
  
      bShowImageFiles.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              configureFilesUri(getImageDirString(mContext));
              cursor = getContentResolver().query(getImageFilesUri(mContext), null, null, null, null);
              SimpleCursorAdapter sAdapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.row, cursor, from, to);
              listView.setAdapter(sAdapter);
              listView.setOnItemClickListener(new ListListener());
          }
      });
  
  
      bShowJsonFiles.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              configureFilesUri(getJsonDirString());
              cursor = getContentResolver().query(getJsonFilesUri(), null, null, null, null);
              SimpleCursorAdapter sAdapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.row, cursor, from, to);
              listView.setAdapter(sAdapter);
              listView.setOnItemClickListener(new ListListener());
          }
      });
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  public class ListListener implements OnItemClickListener {
  
      @Override
      public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position, long id) {
          cursor.moveToPosition(position);
          String name = cursor.getString(cursor.getColumnIndex("fileName"));
          Uri fileUri = Uri.parse(FILES_URI + name);
  
          Log.i("DEBUG:", "path: " + fileUri);
  
          String type = getMimeType(name);
          try {
              InputStream inputStream = getContentResolver().openInputStream(fileUri);
              convertInputStreamToFile(inputStream);
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          }
      }
  }
  
  public static String getMimeType(String uri) {
      String extension = uri.substring(uri.lastIndexOf("."));
      String mimeTypeMap = MimeTypeMap.getFileExtensionFromUrl(extension);
      String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(mimeTypeMap);
      return mimeType;
  }
  
  
  public static String getImageDirString(Context aContext) {
      return "drawable-" + getDeviceDpiName(aContext);
  }
  
  public static String getJsonDirString() {
      return "json";
  }
  
  public static Uri getImageFilesUri(Context aContext) {
      return Uri.parse("content://" + PROVIDER_AUTHORITY + "/" + getImageDirString(aContext) + "/");
  }
  
  public static Uri getJsonFilesUri() {
      return Uri.parse("content://" + PROVIDER_AUTHORITY + "/" + getJsonDirString() + "/");
  }
  
  public static String getDeviceDpiName(Context aContext) {
      int density = aContext.getResources().getDisplayMetrics().densityDpi;
      String dpi;
  
      switch(density)
      {
          case DisplayMetrics.DENSITY_LOW:
              dpi =  DENSITY_LOW;
              break;
          case DisplayMetrics.DENSITY_MEDIUM:
              dpi = DENSITY_MEDIUM;
              break;
          case DisplayMetrics.DENSITY_HIGH:
              dpi = DENSITY_HIGH;
              break;
          case DisplayMetrics.DENSITY_XHIGH:
              dpi = DENSITY_XHIGH;
              break;
          case DisplayMetrics.DENSITY_XXHIGH:
              dpi = DENSITY_XXHIGH;
              break;
          default:
              dpi = DENSITY_HIGH;
              break;
      }
      return dpi;
  }
  
  private void configureFilesUri(String filesPath) {
      FILES_URI = Uri.parse("content://" + PROVIDER_AUTHORITY + "/" + filesPath  + "/");
  }
  
  private void convertInputStreamToFile( InputStream aInputStream) {
      File root = android.os.Environment.getExternalStorageDirectory();
      File dir = new File (root.getAbsolutePath() + "/kibo");
      dir.mkdirs();
      File file = new File(dir, "bubu.png");
  
      try {
          FileOutputStream os = new FileOutputStream(file);
          byte[] buffer = new byte[1024];
          int bytesRead;
          //read from is to buffer
          while((bytesRead = aInputStream.read(buffer)) !=-1){
              os.write(buffer, 0, bytesRead);
          }
          aInputStream.close();
          //flush OutputStream to write any buffered data to file
          os.flush();
          os.close();
      } catch (FileNotFoundException e) {
          e.printStackTrace();
          Log.i("DEBUG", "******* File not found. Did you" +
                  " add a WRITE_EXTERNAL_STORAGE permission to the   manifest?");
      } catch (IOException e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p><strong>Explanation:</strong> So you can see that currently I transfer the <code>Uri</code> to <code>InputStream</code> that in it's turn gets converted to file using an <code>FileOutputStream</code>. And this works as long as I get drawables files from the second project. But if I get a json file the application crashes because the <code>InputStream</code> I getting from this file is null for some reason.</p>
  
  <p><strong>UPDATE (19.11.14):</strong> After additional research I realized that the reason that I can't get an InputStream for the <strong>.txt</strong> files is because they are getting compressed at compile time (as opposed to the drawable <strong>.png</strong> files which is already a compressed format)</p>
  
  <p><strong>So the question is:</strong> How to prevent gradle from compressing .txt files that are located in the assets folder?</p>