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
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...
- Sign In With Apple OAuth Help
Hi All! I've got a flutter & appwrite app which Im trying to use sign in with apple for. I already have sign in with google working and the function is the sam...
- Custom Domains
Hi All, Should be a quick config issue. I'm setting up custom domains on the hosted version. I have verified the domain with the CNAME but appwrite isn't gene...