0

我一直无法弄清楚这一点。我在 android 4.4.2 中使用 qpython3 和 Metro pcs Samsung Galaxy lite。我在 android 上做的开发很少,所以我不熟悉 android 和 windows 之间的差异以及如何弄清楚它。

我能想到的只是我在stackoverflow上找到的:

import android
url = "http://www.Google.com"
android.Android().startActivity('android.intent.action.VIEW'‌​, url)

哪个没有做任何事情。一旦您尝试运行该程序,就会弹出此错误,仅此而已。:

/data/data/com.hipipal.qpy3/files/bin/qpython.sh"/storage/emulated/0/com.hipipal.qpyplus/.last_tmp.py" && exit 
s/.last_tmp.py" && exit  < 
    File "/storage/emulated/0/com.hipipal.qpyplus/.last_tmp.py", line 3 
    android.Android().startActivity('android.intent.action.VIEW'‌​‌​, url) ^     

SyntaxError: invalid character in identifier 1|u0_a194@gardalteMetroPCS:/ $

有任何想法吗?

4

1 回答 1

1

当我自己尝试代码时,我得到了同样的错误。我通过将 's 更改为 "s 并导入 android导入 androidhelper来修复,因此代码最终像这样并且它起作用了:

import androidhelper 

url = "http://www.Google.com"
androidhelper.Android().startActivity("android.intent.action.VIEW", url)
于 2021-08-11T21:46:36.063 回答