Repository: flutter
Issue: android platform plug can't read raw file on release mode
Labels: platform-android,a: platform-views,has reproducible steps,P2,found in release: 3.0,found in release: 3.1,team-android,triaged-android

**1.Create a android plug.  add any raw file.**
![微信图片_20220819153950](https://user-images.githubusercontent.com/62126718/185568919-3534e4b3-a5da-446f-813a-34c84065e759.png)
**2. add readRawFile method in method channel on dart file.**
**3. add readRawFile callback in  onMethodCall of FlutterPlugin on java file.**
```
`public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
   if (call.method.equals("readRawFile")) {
      if(applicationContext == null){
        result.success(false);
        return;
      }
      String fileName = (String) call.arguments;
      if(fileName.length() > 0)
      {
        try {

          if(fileName.contains(".")){
            fileName = fileName.split("\\.")[0];
          }
          Log.e("rawFileTest","fileName:" + fileName);
//            fileName = "test";
          int resourceId = applicationContext.getResources().getIdentifier(fileName,"raw",applicationContext.getPackageName());
          Log.e("rawFileTest","resourceId:" + resourceId);
          InputStream im = applicationContext.getResources().openRawResource(resourceId);
          BufferedReader read = new BufferedReader(new InputStreamReader(im));
          StringBuffer out =   new StringBuffer();
          String line;
          while((line = read.readLine()) != null) {
            out.append(line).append("\n");
          }
          Log.e("rawFileTest","data:" + out);
          result.success(true);

        }
        catch (Exception e)
        {
          e.printStackTrace();
          result.success(false);
        }

      }
      else
      {
        result.success(false);
      }
    }
    else {
      result.notImplemented();
    }
  }`
```

**4. run it on debug mode,it works.  it can't read this file on release mode.**

**5. if use fileName = "test" immediate，it works.** 

6. sample: [https://gitee.com/liqping/myflutter.git](url)
7. flutter doctor -v
```
`Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [版本 10.0.19043.1889], locale zh-CN)
    • Flutter version 3.0.5 at D:\fluter
    • Upstream repository https://github.com/flutter/flutter.git
    • FLUTTER_GIT_URL = https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (5 weeks ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at C:\Users\liping\AppData\Local\Android\sdk
    • Platform android-32, build-tools 32.0.0
    • Java binary at: D:\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.10.3)
    • Visual Studio at D:\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.10.31424.327
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.2)
    • Android Studio at D:\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[√] Connected device (4 available)
    • yx rk3288 (mobile) • ML5RRGLM2Q • android-arm    • Android 5.1.1 (API 22)
    • Windows (desktop)  • windows    • windows-x64    • Microsoft Windows [版本 10.0.19043.1889]
    • Chrome (web)       • chrome     • web-javascript • Google Chrome 104.0.5112.81
    • Edge (web)         • edge       • web-javascript • Microsoft Edge 104.0.1293.54

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```
`