whenever i'm using the setEndpoint method it gives me java Ambiguous error help me to resolve this issue here is the my code
public class MainActivity extends AppCompatActivity { private final String URL = "https://cloud.appwrite.io/v1"; Account account;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
io.appwrite.Client client = new io.appwrite.Client(this)
.setEndpoint(URL)
.setProject("6648a30b00390a48c964")
.setSelfSigned(true);
account = new Account(client);
account.create(
"unique_user_id",
"email@google.com",
"password@12",
Object.class, new Continuation<User<Object>>() {
@NonNull
@Override
public CoroutineContext getContext() {
return null;
}
@Override
public void resumeWith(@NonNull Object o) {
if (o instanceof User){
Log.d("Appwrite","User Created"+o);
}
else if (o instanceof AppwriteException){
Log.e("Appwrite","Error : "+((AppwriteException) o).getMessage());
}
}
}
);
}
}
Could you provide the logcat?
error: reference to setEndpoint is ambiguous .setEndpoint(URL) ^ both method setEndpoint(String) in Client and method setEndpoint(String) in Client match
only this showing..
I think the appwrite SDK is for kotlin and not for java?
However you can add kotlin files in your android studio project
As it can interoperate with java
ohh okiee is java sdk available ?
then what i do now ??
I think you can mix java and kotlin on android studio, but not sure
but if i'm not wrong appwrite android sdk work for both languages kotlin and java..
The code to init the SDK should look like this:
Client client = new Client(context)
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2"); // Your project ID
It's documented here: https://appwrite.io/docs/references/cloud/client-android-java/account
but i'm facing this issue right now { reference to setEndpoint is ambiguous .setEndpoint(URL) both method setEndpoint(String) in Client and method setEndpoint(String) in Client match }
Thos doesn't looks like the example I sent you
i've done many ways including your example but still facing the same issue
What's the SDK version you're using?
Is this cloud or self-hosted?
Could you try adding the URL directly into the corresponding place?
5.1.1
yes but still facing the same issue..
Hi @Batman did you find any solution ? I am having exact same problem and i couldnt find a solution.
Hlo @Batman @metin did you find any solution? I am also having same problem.
@be4st@metin If you're still facing it, it will be better creating a new post
@Batman instead of setting the endpoint using the function, you can use the constructor of Client to set your endpoint. something like this:
this.client = new Client(context, BuildConfig.ENDPOINT_URL);
Recommended threads
- Functions not executing after usage rese...
Hi team, Last month my project hit 100% usage and functions stopped working (expected). Now the new month has started and usage has reset, requests are going ...
- Functions never end and always fail (sta...
Hi ! I'm using Appwrite Cloud Pro and function execution from appwrite website is KO. Deploying starter function template, execution is always Failed and the ...
- My function executions console if overwh...
It seems the requests are getting processed correctly but it is using a older version of the backend. And it seems the cron requests done an hour ago are shown ...