Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 7: Cannot access clipboard #1562

Closed
ddkwork opened this issue Nov 17, 2020 · 12 comments
Closed

Android 7: Cannot access clipboard #1562

ddkwork opened this issue Nov 17, 2020 · 12 comments
Labels
bug Something isn't working help wanted Extra attention is needed OS:Android Tickets affecting only Android devices

Comments

@ddkwork
Copy link

ddkwork commented Nov 17, 2020

If widget use chinese text,entry can't copy any on Android 7.0.

Go:1.15
Fyne:1.4.x

@andydotxyz
Copy link
Member

Do you have any more information about the d4evice, perhaps some screenshot or detailed steps to replicate?

@andydotxyz andydotxyz added the question A question has been asked label Nov 17, 2020
@ddkwork
Copy link
Author

ddkwork commented Nov 17, 2020

您是否还有有关d4evice的更多信息,也许有一些截图或要复制的详细步骤?

setup:

//-----------------------------------
go.mod
module entryTest

go 1.15

require (
fyne.io/fyne v1.4.1-0.20201116181323-96c38fbcc8c9
)

a.go
//----------------------------------
package main

import (
"fyne.io/fyne/app"
"fyne.io/fyne/container"
"fyne.io/fyne/widget"
)

func main() {
a := app.New()
w := a.NewWindow("entry demo")
w.CenterOnScreen()
e := widget.NewEntry()
m := widget.NewMultiLineEntry()
w.SetContent(container.NewVBox(e, m))
w.ShowAndRun()
}

build apk
//--------------------------------
fyne package -os android/arm64 -appID com.goTemplate.gen -icon C:\Windows\myapp.png

adb logcat:
11-15 14:50:09.549 F/Fyne (12998): cannot lookup clipboard
11-15 14:50:12.028 W/Atfwd_Sendcmd( 8829): AtCmdFwd service not published, waiting... retryCnt : 5
11-15 14:50:12.065 F/Fyne (12998): cannot lookup clipboard
11-15 14:51:01.604 F/Fyne (13605): cannot lookup clipboard
...

11 16:17:14.525 F/libc (17775): Fatal signal 6 (SIGABRT), code -6 in tid 17796 (Thread-7)
11-11 16:17:14.635 F/DEBUG (18380): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-11 16:17:14.636 F/DEBUG (18380): Build fingerprint: 'Xiaomi/hydrogen/hydrogen:7.0/NRD90M/V10.2.2.0.NBCMIXM:user/release-keys'
11-11 16:17:14.636 F/DEBUG (18380): Revision: '0'
11-11 16:17:14.636 F/DEBUG (18380): ABI: 'arm64'
11-11 16:17:14.636 F/DEBUG (18380): pid: 17775, tid: 17796, name: Thread-7 >>> com.example.myapp <<<
11-11 16:17:14.636 F/DEBUG (18380): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------

image
image
image
select all--> copy-->...
log.txt

@andydotxyz
Copy link
Member

andydotxyz commented Nov 17, 2020

It looks like you're hitting an unavailable clipboard for some reason:

11-15 14:50:09.549 F/Fyne (12998): cannot lookup clipboard

As your example contains no chinese I will assume this is not specific to that language

@andydotxyz andydotxyz changed the title Entry bug Android 7: Cannot access clipboard Nov 17, 2020
@andydotxyz andydotxyz added the OS:Android Tickets affecting only Android devices label Nov 17, 2020
@andydotxyz
Copy link
Member

For searchability later this is clearly as a result of the crash fix in #1511

@andydotxyz andydotxyz added bug Something isn't working help wanted Extra attention is needed and removed question A question has been asked labels Nov 18, 2020
@ddkwork
Copy link
Author

ddkwork commented Nov 21, 2020

您似乎由于某些原因碰到了不可用的剪贴板:

11-15 14:50:09.549 F/Fyne (12998): cannot lookup clipboard

由于您的示例不包含中文,因此我认为这不是该语言所特有的

Do you have any way for debug?please give a chance. Thank you.

@andydotxyz
Copy link
Member

It means that the response to Context.getSystemService("clipboard") is failing.
If you can find any reason why that would happen it would be very helpful.
Perhaps you can run an Android app on the same phone and see it's error, it will be easier to debug.

@ddkwork
Copy link
Author

ddkwork commented Nov 22, 2020

这意味着响应Context.getSystemService("clipboard")失败。
如果您找到发生这种情况的任何原因,将非常有帮助。
也许您可以在同一部手机上运行一个Android应用程序并看到它的错误,它将更易于调试。

no, i was try to print class ID, the log printed a big number.

image
image

@ddkwork
Copy link
Author

ddkwork commented Nov 24, 2020

这意味着响应Context.getSystemService("clipboard")失败。
如果您找到发生这种情况的任何原因,将非常有帮助。
也许您可以在同一部手机上运行一个Android应用程序并看到它的错误,它将更易于调试。

//Hello, dear fyne development team, your code is excellent, thank you again.
//After a long time of obtaining adb logs and referring to the fyne demo, I came to the conclusion: To use the clipboard function on Android 7.0 API24, the following conditions need to be met. There are too many restrictions and I hope to improve.
//1. Custom theme is invalid in Chinese font
//2. Write log file is invalid,
//3. The print log is invalid,
//4. Do not use the global window handle to occupy the main window handle failure (the child window displays the control layout object, the global window is equal to the child window, the main window is displayed and running)
//5. The drop-down box coverage fails (maybe the focus is covered)

@andydotxyz
Copy link
Member

no, i was try to print class ID, the log printed a big number.

in this case find_class or find_method will not fail as they are part of the Android SDK.
What is failing is the execution of getSystemService("clipboard") - for some reason the standard service is not found.

Can you print the details of err that is encountered?

@ddkwork
Copy link
Author

ddkwork commented Nov 24, 2020

getSystemService

log.txt
11-24 17:26:07.950 F/Fyne ( 2897): cannot lookup clipboard

@andydotxyz
Copy link
Member

The log we already have is not enough, the error is not reported.
Can you test with an Android app, using the standard Java code, and report the Android stack trace?

@ddkwork
Copy link
Author

ddkwork commented Nov 24, 2020

我们已经拥有的日志还不够,不报告错误。
您可以使用标准Java代码使用Android应用进行测试,并报告Android堆栈跟踪吗?

Sorry, i don't know java language

@ddkwork ddkwork closed this as completed Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed OS:Android Tickets affecting only Android devices
Projects
None yet
Development

No branches or pull requests

2 participants