I am trying to test android deep link urls through adb to launch my app

前端 未结 11 680
孤街浪徒
孤街浪徒 2021-01-30 10:07

When I type the command in adb:

./adb shell am start -W -a android.intent.action.VIEW -d \"example:gizmos\" com.myapp

I get this error:

11条回答
  •  野的像风
    2021-01-30 10:56

    Just in case someone else has the problem that I had, namely that adb shell am start ... does not work, if you have a file:///... or content://...URI in your intent filter that has a mime type specified, for example

    
      
      
      
      
      
      
      
    
    

    You need to specify the mime type on the command line by using the -t parameter:

    adb shell am start -W -a android.intent.action.VIEW -d "file:///sdcard/myfolder/myfile.txt" -t "text/plain" com.myapp
    

    or else you get the same error message as the OP.

    Based on the experience I just had I recommend using this list of available adb commands. It seems to be more recent than the help texts from the shell of my test device running Android 8.

提交回复
热议问题