Repository: flutter
Issue: initializing DevFS: JSON-RPC error needs to surface cause and potential solution
Labels: tool,a: quality,P2,team-tool,triaged-tool

Hi i am constantly having error : **Error initializing DevFS: JSON-RPC error -32603 (internal error): Internal error**  after **Built build\app\outputs\apk\debug\app-debug.apk.** step of flutter run.

Here is output of my flutter run -v:

```

> [   +2 ms] > Task :app:assembleDebug
> [   +1 ms] 32 actionable tasks: 30 executed, 2 up-to-date
> [ +676 ms] Running Gradle task 'assembleDebug'... (completed in 47.8s)
> [+1287 ms] calculateSha: LocalDirectory: 'E:\Mobility\gdg\dyn_link_gdg\build\app\outputs\apk'/app.apk
> [ +146 ms] calculateSha: reading file took 138us
> [ +931 ms] calculateSha: computing sha took 929us
> [   +9 ms] Built build\app\outputs\apk\debug\app-debug.apk.
> [   +7 ms] executing: C:\Users\LENOVO\AppData\Local\Android\sdk\build-tools\28.0.3\aapt dump xmltree
> E:\Mobility\gdg\dyn_link_gdg\build\app\outputs\apk\app.apk AndroidManifest.xml
> [  +49 ms] Exit code 0 from: C:\Users\LENOVO\AppData\Local\Android\sdk\build-tools\28.0.3\aapt dump xmltree
> E:\Mobility\gdg\dyn_link_gdg\build\app\outputs\apk\app.apk AndroidManifest.xml
> [   +3 ms] N: android=http://schemas.android.com/apk/res/android
>              E: manifest (line=2)
>                A: android:versionCode(0x0101021b)=(type 0x10)0x1
>                A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
>                A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1c
>                A: android:compileSdkVersionCodename(0x01010573)="9" (Raw: "9")
>                A: package="com.example.dyn_link_gdg" (Raw: "com.example.dyn_link_gdg")
>                A: platformBuildVersionCode=(type 0x10)0x1
>                A: platformBuildVersionName="1.0.0" (Raw: "1.0.0")
>                E: uses-sdk (line=7)
>                  A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
>                  A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1c
>                E: uses-permission (line=14)
>                  A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
>                E: uses-permission (line=15)
>                  A: android:name(0x01010003)="android.permission.ACCESS_NETWORK_STATE" (Raw: "android.permission.ACCESS_NETWORK_STATE")   
>                E: uses-permission (line=16)
>                  A: android:name(0x01010003)="android.permission.WAKE_LOCK" (Raw: "android.permission.WAKE_LOCK")
>                E: uses-permission (line=17)
>                  A: android:name(0x01010003)="com.google.android.c2dm.permission.RECEIVE" (Raw:
>                  "com.google.android.c2dm.permission.RECEIVE")
>                E: permission (line=19)
>                  A: android:name(0x01010003)="com.example.dyn_link_gdg.permission.C2D_MESSAGE" (Raw:
>                  "com.example.dyn_link_gdg.permission.C2D_MESSAGE")
>                  A: android:protectionLevel(0x01010009)=(type 0x11)0x2
>                E: uses-permission (line=23)
>                  A: android:name(0x01010003)="com.example.dyn_link_gdg.permission.C2D_MESSAGE" (Raw:
>                  "com.example.dyn_link_gdg.permission.C2D_MESSAGE")
>                E: application (line=31)
>                  A: android:label(0x01010001)="dyn_link_gdg" (Raw: "dyn_link_gdg")
>                  A: android:icon(0x01010002)=@0x7f030000
>                  A: android:name(0x01010003)="io.flutter.app.FlutterApplication" (Raw: "io.flutter.app.FlutterApplication")
>                  A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
>                  E: activity (line=36)
>                    A: android:theme(0x01010000)=@0x7f050000
>                    A: android:name(0x01010003)="com.example.dyn_link_gdg.MainActivity" (Raw: "com.example.dyn_link_gdg.MainActivity")     
>                    A: android:launchMode(0x0101001d)=(type 0x10)0x1
>                    A: android:configChanges(0x0101001f)=(type 0x11)0x400037b4
>                    A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
>                    A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
>                    E: meta-data (line=50)
>                      A: android:name(0x01010003)="io.flutter.app.android.SplashScreenUntilFirstFrame" (Raw:
>                      "io.flutter.app.android.SplashScreenUntilFirstFrame")
>                      A: android:value(0x01010024)=(type 0x12)0xffffffff
>                    E: intent-filter (line=54)
>                      E: action (line=55)
>                        A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
>                      E: category (line=57)
>                        A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
>                  E: receiver (line=61)
>                    A: android:name(0x01010003)="com.google.android.gms.measurement.AppMeasurementReceiver" (Raw:
>                    "com.google.android.gms.measurement.AppMeasurementReceiver")
>                    A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
>                    A: android:exported(0x01010010)=(type 0x12)0x0
>                  E: receiver (line=66)
>                    A: android:name(0x01010003)="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver" (Raw:
>                    "com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver")
>                    A: android:permission(0x01010006)="android.permission.INSTALL_PACKAGES" (Raw: "android.permission.INSTALL_PACKAGES")   
>                    A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
>                    A: android:exported(0x01010010)=(type 0x12)0xffffffff
>                    E: intent-filter (line=71)
>                      E: action (line=72)
>                        A: android:name(0x01010003)="com.android.vending.INSTALL_REFERRER" (Raw: "com.android.vending.INSTALL_REFERRER")   
>                  E: service (line=76)
>                    A: android:name(0x01010003)="com.google.android.gms.measurement.AppMeasurementService" (Raw:
>                    "com.google.android.gms.measurement.AppMeasurementService")
>                    A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
>                    A: android:exported(0x01010010)=(type 0x12)0x0
>                  E: service (line=80)
>                    A: android:name(0x01010003)="com.google.android.gms.measurement.AppMeasurementJobService" (Raw:
>                    "com.google.android.gms.measurement.AppMeasurementJobService")
>                    A: android:permission(0x01010006)="android.permission.BIND_JOB_SERVICE" (Raw: "android.permission.BIND_JOB_SERVICE")   
>                    A: android:enabled(0x0101000e)=(type 0x12)0xffffffff
>                    A: android:exported(0x01010010)=(type 0x12)0x0
>                  E: receiver (line=86)
>                    A: android:name(0x01010003)="com.google.firebase.iid.FirebaseInstanceIdReceiver" (Raw:
>                    "com.google.firebase.iid.FirebaseInstanceIdReceiver")
>                    A: android:permission(0x01010006)="com.google.android.c2dm.permission.SEND" (Raw:
>                    "com.google.android.c2dm.permission.SEND")
>                    A: android:exported(0x01010010)=(type 0x12)0xffffffff
>                    E: intent-filter (line=90)
>                      E: action (line=91)
>                        A: android:name(0x01010003)="com.google.android.c2dm.intent.RECEIVE" (Raw:
>                        "com.google.android.c2dm.intent.RECEIVE")
>                      E: category (line=93)
>                        A: android:name(0x01010003)="com.example.dyn_link_gdg" (Raw: "com.example.dyn_link_gdg")
>                  E: receiver (line=100)
>                    A: android:name(0x01010003)="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" (Raw:
>                    "com.google.firebase.iid.FirebaseInstanceIdInternalReceiver")
>                    A: android:exported(0x01010010)=(type 0x12)0x0
>                  E: service (line=107)
>                    A: android:name(0x01010003)="com.google.firebase.iid.FirebaseInstanceIdService" (Raw:
>                    "com.google.firebase.iid.FirebaseInstanceIdService")
>                    A: android:exported(0x01010010)=(type 0x12)0xffffffff
>                    E: intent-filter (line=110)
>                      A: android:priority(0x0101001c)=(type 0x10)0xfffffe0c
>                      E: action (line=111)
>                        A: android:name(0x01010003)="com.google.firebase.INSTANCE_ID_EVENT" (Raw: "com.google.firebase.INSTANCE_ID_EVENT") 
>                  E: provider (line=115)
>                    A: android:name(0x01010003)="com.google.firebase.provider.FirebaseInitProvider" (Raw:
>                    "com.google.firebase.provider.FirebaseInitProvider")
>                    A: android:exported(0x01010010)=(type 0x12)0x0
>                    A: android:authorities(0x01010018)="com.example.dyn_link_gdg.firebaseinitprovider" (Raw:
>                    "com.example.dyn_link_gdg.firebaseinitprovider")
>                    A: android:initOrder(0x0101001a)=(type 0x10)0x64
>                  E: meta-data (line=121)
>                    A: android:name(0x01010003)="com.google.android.gms.version" (Raw: "com.google.android.gms.version")
>                    A: android:value(0x01010024)=@0x7f020000
> [ +204 ms] Stopping app 'app.apk' on SM A205F.
> [   +8 ms] executing: C:\Users\LENOVO\AppData\Local\Android\sdk\platform-tools\adb.exe -s R58M680628W shell am force-stop
> com.example.dyn_link_gdg
> [ +233 ms] executing: C:\Users\LENOVO\AppData\Local\Android\sdk\platform-tools\adb.exe -s R58M680628W shell pm list packages
> com.example.dyn_link_gdg
> [ +257 ms] package:com.example.dyn_link_gdg
> [  +12 ms] executing: C:\Users\LENOVO\AppData\Local\Android\sdk\platform-tools\adb.exe -s R58M680628W shell cat
> /data/local/tmp/sky.com.example.dyn_link_gdg.sha1
> [ +187 ms] a5ce69b28dbfcc03487f8cbd61e2547ba82e317a
> [   +5 ms] Installing APK.
> [  +24 ms] executing: C:\Users\LENOVO\AppData\Local\Android\sdk\platform-tools\adb.exe version
> [  +96 ms] Android Debug Bridge version 1.0.39
>            Version 0.0.1-4500957
>            Installed as C:\Users\LENOVO\AppData\Local\Android\sdk\platform-tools\adb.exe
> [  +26 ms] executing: C:\Users\LENOVO\AppData\Local\Android\sdk\platform-tools\adb.exe start-server
> [  +92 ms] Installing build\app\outputs\apk\app.apk...
> [   +5 ms] executing: C:\Users\LENOVO\AppData\Local\Android\sdk\platform-tools\adb.exe -s R58M680628W install -t -r
> E:\Mobility\gdg\dyn_link_gdg\build\app\outputs\apk\app.apk
> [+14070 ms] Success
> [   +4 ms] Installing build\app\outputs\apk\app.apk... (completed in 14.1s)
> [  +29 ms] executing: C:\Users\LENOVO\AppData\Local\Android\sdk\platform-tools\adb.exe -s R58M680628W shell echo -n
> 61a953a40313c14e38b86e90b32f2a9d2a26b265 > /data/local/tmp/sky.com.example.dyn_link_gdg.sha1
> [ +190 ms] SM A205F startApp
> [   +3 ms] executing: C:\Users\LENOVO\AppData\Local\Android\sdk\platform-tools\adb.exe -s R58M680628W shell am start -a
> android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation true --ez enable-dart-profiling true --ez enable-checked-mode  
> true --ez verify-entry-points true com.example.dyn_link_gdg/com.example.dyn_link_gdg.MainActivity
> [ +529 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.example.dyn_link_gdg/.MainActivity (has extras) }
> [   +4 ms] Waiting for observatory port to be available...
> [+3590 ms] Observatory URL on device: http://127.0.0.1:45912/Xz_Ai1I0gkM=/
> [   +8 ms] executing: C:\Users\LENOVO\AppData\Local\Android\sdk\platform-tools\adb.exe -s R58M680628W forward tcp:0 tcp:45912
> [ +125 ms] 61323
> [   +4 ms] Forwarded host port 61323 to device port 45912 for Observatory
> [  +37 ms] Connecting to service protocol: http://127.0.0.1:61323/Xz_Ai1I0gkM=/
> [ +666 ms] Successfully connected to service protocol: http://127.0.0.1:61323/Xz_Ai1I0gkM=/
> [  +43 ms] Sending to VM service: getVM({})
> [  +27 ms] Result: {type: VM, name: vm, architectureBits: 64, hostCPU: Unknown, operatingSystem: android, targetCPU: arm64, version: 2.5.0(Fri Sep 6 20:10:36 2019 +0200) on "android_arm64", _profilerMode: VM, _nativeZoneMemoryUsage: 0, pid: 21324, startTime: 157396...        
> [  +24 ms] Sending to VM service: getIsolate({isolateId: isolates/3528477923465135})
> [  +36 ms] Sending to VM service: _flutter.listViews({})
> [  +17 ms] Result: {type: Isolate, id: isolates/3528477923465135, name: main, number: 3528477923465135, _originNumber: 3528477923465135,
> startTime: 1573969840947, _heaps: {new: {type: HeapSpace, name: new, vmName: Scavenger, collections: 0, avgCollectionPeriodMillis...      
> [  +30 ms] Result: {type: FlutterViewList, views: [{type: FlutterView, id: _flutterView/0x78e9e72320, isolate: {type: @Isolate, fixedId:
> true, id: isolates/3528477923465135, name: main.dart$main-3528477923465135, number: 3528477923465135}}]}
> [  +35 ms] DevFS: Creating new filesystem on the device (null)
> [  +17 ms] Sending to VM service: _createDevFS({fsName: dyn_link_gdg})
> [  +78 ms] Error -32603 received from application: Internal error
> [   +8 ms] {details: _createDevFS: Unexpected exception:FileSystemException: Creation of temporary directory failed, path =
> '/data/user/0/com.example.dyn_link_gdg/code_cache' (OS Error: Permission denied, errno = 13)
>            #0      _Directory.createTemp.<anonymous closure> (dart:io/directory_impl.dart:162:9)
>            #1      _RootZone.runUnary (dart:async/zone.dart:1379:54)
>            #2      _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
>            #3      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
>            #4      Future._propagateToListeners (dart:async/future_impl.dart:707:32)
>            #5      Future._completeWithValue (dart:async/future_impl.dart:522:5)
>            #6      Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:552:7)
>            #7      _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
>            #8      _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
>            #9      _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
>            #10     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)
>            }
> [  +47 ms] Error initializing DevFS: JSON-RPC error -32603 (internal error): Internal error
> [  +28 ms] "flutter run" took 95,767ms.
> 
> #0      throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
> #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:477:7)
> <asynchronous suspension>
> #2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:490:18)
> #3      _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
> #4      _rootRunUnary (dart:async/zone.dart:1132:38)
> #5      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
> #6      _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
> #7      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
> #8      Future._propagateToListeners (dart:async/future_impl.dart:707:32)
> #9      Future._completeWithValue (dart:async/future_impl.dart:522:5)
> #10     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15)
> #11     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:288:13)
> #12     RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)
> #13     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
> #14     _rootRunUnary (dart:async/zone.dart:1132:38)
> #15     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
> #16     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
> #17     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
> #18     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
> #19     Future._completeWithValue (dart:async/future_impl.dart:522:5)
> #26     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
> #27     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
> #28     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
> #29     Future._completeWithValue (dart:async/future_impl.dart:522:5)
> #30     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:552:7)
> #31     _rootRun (dart:async/zone.dart:1124:13)
> #32     _CustomZone.run (dart:async/zone.dart:1021:19)
> #33     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
> #34     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
> #35     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
> #36     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
> #37     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
> #38     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)
> 

```
Here is the output of flutter doctor:

> `[√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [Version 10.0.18362.476], locale en-US)
>     • Flutter version 1.9.1+hotfix.6 at E:\Installations\flutter_windows_v1.0.0-stable\flutter
>     • Framework revision 68587a0916 (9 weeks ago), 2019-09-13 19:46:58 -0700
>     • Engine revision b863200c37
>     • Dart version 2.5.0
> 
> [!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
>     • Android SDK at C:\Users\LENOVO\AppData\Local\Android\sdk
>     • Android NDK location not configured (optional; useful for native profiling support)
>     • Platform android-28, build-tools 28.0.3
>     • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
>     • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
>     X Android license status unknown.
>       Try re-installing or updating your Android SDK Manager.
>       See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.    
> 
> [√] Android Studio (version 3.1)
>     • Android Studio at C:\Program Files\Android\Android Studio
>     • Flutter plugin version 24.1.1
>     • Dart plugin version 173.4700
>     • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
> 
> [√] IntelliJ IDEA Ultimate Edition (version 2018.1)
>     • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2018.1.2
>     • Flutter plugin version 24.1.2
>     • Dart plugin version 181.4668.60
> 
> [√] VS Code, 64-bit edition (version 1.33.1)
>     • VS Code at C:\Program Files\Microsoft VS Code
>     • Flutter extension version 3.2.0
> 
> [√] Connected device (1 available)
>     • SM A205F • R58M680628W • android-arm64 • Android 9 (API 28)`