Comments (12)
Hello @zhangchengtest . This command doesn't read the file from the file system. It is read from the body of the request. Have you tried one of the "body" methods?
from gomobile-ipfs.
Hi, I use the method withBody like this
File file = new File(Environment.getExternalStorageDirectory(), fileName);
InputStream inputStream = ipfs.newRequest("add").withBody(file).send();
But I got anthor error
go.Universe$proxyerror: read unix @->//data/user/0/com.cunw.peer/cache/sock/0000000: use of closed network connection
from gomobile-ipfs.
What is your test setup? Are you using an Android simulator, or connected to a real phone? Before trying new commands, do the test commands work? For example, in the packages directory:
make test_bridge.android
from gomobile-ipfs.
I use a real phone and there is another error when I use another file
go.Universe$proxyerror: Post "http://unix/api/v0/add?": EOF
from gomobile-ipfs.
We need to know if basic IPFS is working. Does make test_bridge.android
work?
from gomobile-ipfs.
not try this, but i will try later.
but I have tried a lot command like ipfs get , ipfs swam peers...
they all works in the app installed in my phone
only the "add" not work
from gomobile-ipfs.
make test_bridge.android have no problem
from gomobile-ipfs.
follow the example it is ok. but I got the cid not same as the cid where I add the same file to computer.
`
ByteArrayOutputStream outputStream = new ByteArrayOutputStream( );
outputStream.write("--------------------------5f505897199c8c52\r\n".getBytes());
outputStream.write("Content-Disposition: form-data; name="file"\r\n".getBytes());
outputStream.write("Content-Type: application/octet-stream\r\n\r\n".getBytes());
outputStream.write(buffer.toByteArray());
outputStream.write("\r\n\r\n--------------------------5f505897199c8c52--".getBytes());
byte body[] = outputStream.toByteArray();
ArrayList jsonList = ipfs.newRequest("add")
.withHeader("Content-Type", "multipart/form-data; boundary=------------------------5f505897199c8c52")
.withBody(body)
.sendToJSONList();
String cid = jsonList.get(0).getString("Hash");
Log.d(TAG, "cid is " + cid);
from gomobile-ipfs.
witbody bytes function works, but inputstream not work
always throw the EOF exception in InputStreamToGo
from gomobile-ipfs.
Hello @zhangchengtest . Thank you for testing. I have reproduced your error and I created a bug report. We will look into it.
#143
from gomobile-ipfs.
Hello @zhangchengtest . We merged pull request #146 to fix the EOF exception in InputStreamToGo . This test of the API now works.
Does this resolve your issue?
from gomobile-ipfs.
Bug was fixed. This issue is inactive. Presumed resolved. Closing.
from gomobile-ipfs.
Related Issues (20)
- [Android] org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':bridge'.
- Error configuring bootstrap -- ERROR: input isn't valid multihash HOT 2
- "swarm.key"--How to set up a private network on mobile HOT 2
- Build fails with "You must specify a URL for a Maven repository" HOT 4
- make build_core.ios report an error HOT 3
- Download multiple large files at the same time, error reported:A/go/Seq: NewByteArray failed HOT 9
- [FEATURE]: Support go 1.18 HOT 1
- Support iossimulator in Makefile HOT 1
- Could not find ipfs.gomobile:core:0.0.42-dev. HOT 22
- When I use files/rm or cp, it report Error "sending request failed" HOT 7
- Build error for Xcode 13.4.1 HOT 4
- How to excute pubsub/sub use gomobile-ipfs HOT 2
- Command to show the DNS server address, and option to set it HOT 1
- Error "Repo opening failed" on Android API 30+
- Java RequestBuilder.withBody(InputStream) EOF error
- how to build on Windows 11? Or can you provide built package? HOT 3
- Update to kubo latest version HOT 1
- Publish to F-Droid HOT 2
- Why android bridge module require location permission, I could not find android LocationManager usage in anywhere of project code.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gomobile-ipfs.