I have this path in my firestore (com.google.android.gms.tasks.zzu#540f03f). How get image from storage use that path
This is the code that I am using
userImageRef= FirebaseStorage.getInstance().getReferenceFromUrl(MainActivity.avbUser.getProfilePic());
userImageRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
#Override
public void onSuccess(Uri uri) {
imgUrl=uri.toString();
}
});
The error that I get
Process: com.example.fastfoods, PID: 939
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fastfoods/com.example.fastfood.buyerhome}: java.lang.IllegalArgumentException: The storage Uri could not be parsed.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2576)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2658)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1492)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5737)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: java.lang.IllegalArgumentException: The storage Uri could not be parsed.
at com.google.firebase.storage.FirebaseStorage.getReferenceFromUrl(com.google.firebase:firebase-storage##17.0.0:279)
at com.example.fastfood.buyerhome.onCreate(buyerhome.java:39)
at android.app.Activity.performCreate(Activity.java:6309)
Related
My game is crashing on a real device as well as on emulator & when I check in Logcat I see this error:-
2019-01-20 10:46:50.444 4990-4990/com.app.app_name E/art: No
implementation found for boolean
com.app_ad_secret.utils.PTJniHelper.isAdNetworkActive(java.lang.String)
(tried Java_com_app_1ad_1secret_utils_PTJniHelper_isAdNetworkActive
and
Java_com_app_1ad_1secret_utils_PTJniHelper_isAdNetworkActive__Ljava_lang_String_2) 2019-01-20 10:46:50.445 4990-4990/com.app.app_name E/AndroidRuntime:
FATAL EXCEPTION: main
Process: com.app.app_name, PID: 4990
java.lang.UnsatisfiedLinkError: No implementation found for boolean
com.app_ad_secret.utils.PTJniHelper.isAdNetworkActive(java.lang.String)
(tried Java_com_app_1ad_1secret_utils_PTJniHelper_isAdNetworkActive
and
Java_com_app_1ad_1secret_utils_PTJniHelper_isAdNetworkActive__Ljava_lang_String_2)
at com.app_ad_secret.utils.PTJniHelper.isAdNetworkActive(Native Method)
at com.app.app_name.PTPlayer.onStart(PTPlayer.java:115)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1248)
at android.app.Activity.performStart(Activity.java:6679)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2609)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
When I opened that (PTPlayer.java:115), it took me to this method:-
#Override
protected void onStart() {
super.onStart();
if (PTJniHelper.isAdNetworkActive("kAdMob")) {
rohit_ad_chart_boost.onStart( this );
}
}
I don't understand the problem here & what's causing this?
I am beginner to android studio. Trying to put some hands on basic API call using Retrofit, for PHP API calls, for login. Sorry please correct me if my way of asking such question might be wrong.
Code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
prefConfig = new PrefConfig(this);
apiInterface = ApiClient.getApiClient().create(ApiInterface.class); //Here
if (findViewById(R.id.fragment_container) != null) {
if (savedInstanceState != null) {
return;
}
if (prefConfig.readLoginStatus()) {
getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, new WelcomeFragment()).commit();
} else {
getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, new LoginFragment()).commit();
}
}
}
Everything goes fine when i comment the line labeled Here.
Error From The Log:
Process: com.example.surya.emorecomender, PID: 9729
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.surya.emorecomender/com.example.surya.emorecomender.MainActivity}: java.lang.IllegalArgumentException: baseUrl must end in /: http://10.0.2.2/database_api
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2984)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
Caused by: java.lang.IllegalArgumentException: baseUrl must end in /: http://10.0.2.2/database_api
at retrofit2.Retrofit$Builder.baseUrl(Retrofit.java:513)
at retrofit2.Retrofit$Builder.baseUrl(Retrofit.java:456)
at com.example.surya.emorecomender.ApiClient.getApiClient(ApiClient.java:13)
at com.example.surya.emorecomender.MainActivity.onCreate(MainActivity.java:17)
at android.app.Activity.performCreate(Activity.java:6956)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
This is the most important part:
Process: com.example.surya.emorecomender, PID: 9729
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.surya.emorecomender/com.example.surya.emorecomender.MainActivity}: java.lang.IllegalArgumentException: baseUrl must end in /: http://10.0.2.2/database_api
Copy the java.lang.IllegalArgumentException: baseUrl must end in /: http://10.0.2.2/database_api and google it.
issues is with Twitter button, this is working fine with Android 6 Moto G, while on android 5.0.1 Samsung Note 3 it crashes, on Simulator it works fine too,
However my code for Click is,
TwitterLoginButton twitterLoginButton = (TwitterLoginButton) findViewById(R.id.button_twitter);
twitterLoginButton.setCallback(new Callback<TwitterSession>() {
#Override
public void success(Result<TwitterSession> result) {
Log.d(TAG, "twitterLogin:success" + result);
handleTwitterSession(TwitterAuthProvider.getCredential(
result.data.getAuthToken().token,
result.data.getAuthToken().secret), false);
}
#Override
public void failure(TwitterException exception) {
Log.w(TAG, "twitterLogin:failure", exception);
}
});
twitterLoginButton.setOnClickListener(this);
Issues it is showing is,
java.lang.RuntimeException:Unable to start activity ComponentInfo{com.my.project/com.twitter.sdk.android.core.identity.OAuthActivity}: java.lang.IllegalStateException: Unable to extract the trust manager on okhttp3.internal.Platform$Android#2e0793c7, sslSocketFactory is class crittercism.android.q
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2693)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2758)
at android.app.ActivityThread.access$900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
Caused by: java.lang.IllegalStateException: Unable to extract the trust manager on okhttp3.internal.Platform$Android#2e0793c7, sslSocketFactory is class crittercism.android.q
at okhttp3.OkHttpClient.<init>(OkHttpClient.java:187)
at okhttp3.OkHttpClient.<init>(OkHttpClient.java:60)
at okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:718)
at com.twitter.sdk.android.core.internal.oauth.OAuthService.<init>(OAuthService.java:56)
at com.twitter.sdk.android.core.internal.oauth.OAuth1aService.<init>(OAuth1aService.java:69)
at com.twitter.sdk.android.core.identity.OAuthActivity.onCreate(OAuthActivity.java:69)
at android.app.Activity.performCreate(Activity.java:6283)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2758)
at android.app.ActivityThread.access$900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
i searched a lot on google but unable to find any helpful, solution.
This is a problem with Crittercism. If updating that doesn't help you'll need to report the bug to them.
Currently trying out Google's Places API and meanwhile trying to push a Place to my Firebase database. The code below tries to do that but errors out when it is called.
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PLACE_PICKER_REQUEST) {
if (resultCode == RESULT_OK) {
Place place = PlacePicker.getPlace(this, data);
String toastMsg = String.format("Place: %s", place.getName());
Toast.makeText(this, toastMsg, Toast.LENGTH_LONG).show();
String userUid = FirebaseAuth.getInstance().getCurrentUser().getUid();
DatabaseReference userRef = database.getReference("users/" + userUid);
userRef.setValue(place);
}
}
}
The error I get is as follows:
11-23 18:34:24.874 13155-13155/io.app.roomie E/AndroidRuntime: FATAL EXCEPTION: main
Process: io.app.roomie, PID: 13155
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {io.app.roomie/io.app.roomie.MainActivity}: com.google.firebase.database.DatabaseException: Found conflicting getters for name: getAddress
at android.app.ActivityThread.deliverResults(ActivityThread.java:4089)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4132)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1533)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: com.google.firebase.database.DatabaseException: Found conflicting getters for name: getAddress
at com.google.android.gms.internal.zzamy$zza.<init>(Unknown Source)
at com.google.android.gms.internal.zzamy.zzj(Unknown Source)
at com.google.android.gms.internal.zzamy.zzca(Unknown Source)
at com.google.android.gms.internal.zzamy.zzbz(Unknown Source)
at com.google.firebase.database.DatabaseReference.zza(Unknown Source)
at com.google.firebase.database.DatabaseReference.setValue(Unknown Source)
at io.app.roomie.MainActivity.onActivityResult(MainActivity.java:81)
at android.app.Activity.dispatchActivityResult(Activity.java:6932)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4085)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4132)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1533)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Sorry about the code formatting. I couldn't get it to work otherwise.
The class com.google.android.gms.location.places.Place is not meant to be directly saved into Firebase.
You should write a simple POJO class that contains only the fields you need from Place, copy the data, and save this simple object into the database.
I've been trying to use Firebase's storage libraries to attempt to upload a file using Google's sample code in Android Studio:
FirebaseStorage storage = FirebaseStorage.getInstance();
StorageReference storageRef = storage.getReferenceFromUrl("gs://<your-bucket-name>");
UUID imageID = UUID.randomUUID();
StorageReference pendingImageRef = storageRef.child("products/images/"+imageID);
UploadTask uploadTask = pendingImageRef.putBytes(imageData);
....
Which gave me this:
java.lang.NoClassDefFoundError:
Failed resolution of: Lcom/google/firebase/storage/FirebaseStorage;
at com.myprogram.CreateProductFragment$1.onClick(CreateProductFragment.java:304)
at android.view.View.performClick(View.java:4785)
at android.view.View$PerformClick.run(View.java:19884)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:702)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.storage.FirebaseStorage" on path: ....
My thinking was that this was an issue with dexing, so I rejiggered it and multidexed the application. This did not eliminate the issue.