I am trying to get image from web and put it into ImageView, but Picasso keeps showing errors.. when I refresh androidStudio, it shows another errors..
I looked up for solutions, but there is no relevant up-to-date post anywhere.
If anyone has any idea how to solve it, please comment.
Error: Program type already present: com.squareup.picasso.Action
Error: Program type already present:
com.squareup.picasso.Callback$EmptyCallback
Dependencies:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-
layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.squareup.picasso:picasso:2.5.2'
}
Picasso:
Picasso.with(About.this).load(photo).into(myImageView, new Callback() {
#Override public void onSuccess() {
Log.d("Debug", "Picasso Success");
}
#Override public void onError() {
Log.d("Debug", "Picasso Errored");
}
});
String photo:
String photo = getIntent().getExtras().getString("photo");
try to update to implementation "com.squareup.picasso:picasso:2.71828"
the duplicate entry program type already present can only come from another library or another module. most likely, there is a unnecessary picasso .jar in the libs directory, which ot delete.
Related
I tried to add the firestore dependency and after I did this I got a error saying the following:
Caused by: java.lang.RuntimeException: Duplicate class com.google.protobuf.AbstractMessageLite found in modules protobuf-java-3.15.3 (com.google.protobuf:protobuf-java:3.15.3) and protobuf-javalite-3.19.2 (com.google.protobuf:protobuf-javalite:3.19.2)
The following code are all the dependencies I use hope someone can find the problem.
dependencies {
implementation("androidx.compose.foundation:foundation:1.2.0-alpha07")
implementation 'androidx.core:core-ktx:1.7.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.3.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0"
// Hilt
implementation "com.google.dagger:hilt-android:2.40.5"
kapt "com.google.dagger:hilt-compiler:2.40.5"
// Room
implementation "androidx.room:room-runtime:2.4.1"
implementation "androidx.room:room-ktx:2.4.1"
kapt "androidx.room:room-compiler:2.4.1"
// Navigation
implementation "androidx.navigation:navigation-compose:2.4.0"
implementation "androidx.hilt:hilt-navigation-compose:1.0.0"
//animated navigation
implementation "androidx.navigation:navigation-compose:2.5.0-alpha04"
//implementation "com.google.accompanist:accompanist-navigation-animation:0.16.0"
//IGDB
implementation 'com.github.husnjak:IGDB-API-JVM:1.0.5'
testImplementation "androidx.arch.core:core-testing:2.1.0"
//coil
implementation("io.coil-kt:coil-compose:2.0.0-rc01")
//fuel
implementation 'com.github.kittinunf.fuel:fuel-android:2.3.1'
//system ui
implementation "com.google.accompanist:accompanist-systemuicontroller:0.17.0"
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:29.3.1')
// When using the BoM, you don't specify versions in Firebase library dependencies
// Declare the dependency for the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics-ktx'
// Declare the dependencies for any other desired Firebase products
implementation 'com.google.firebase:firebase-auth-ktx'
implementation 'com.google.firebase:firebase-firestore'
}
I used the GitHub time picker dialog library and I got an error "Can not find symbol R".
1) The library I used.
implementation 'com.kovachcode:timePickerWithSeconds:1.0.1'
2) The error line code is below.
setButton(context.getText(R.string.time_set), this); // in this line
setButton2(context.getText(R.string.cancel), (OnClickListener) null);// in this line
//setIcon(android.R.drawable.ic_dialog_time);
LayoutInflater inflater =
(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.time_picker_dialog, null);//in this line
setView(view);
mTimePicker = (TimePicker) view.findViewById(R.id.timePicker);//in this line
This file is also a read-only file and not editable. Please give me a solution.
3) These are all dependencies I used.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.firebase:firebase-jobdispatcher:0.8.6'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.android.support:design:28.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.volley:volley:1.1.1-rc1'
implementation 'de.hdodenhof:circleimageview:3.0.1'
implementation 'info.androidhive:fontawesome:0.0.5'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.kovachcode:timePickerWithSeconds:1.0.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Please check your manifest and add
tools:replace="android:icon, android:label, android:theme"
import like this in your class.
import com.yourpackage.R;
it can be error on "time_picker_dialog.xml" file or any other xml file. Can you check it?
I'm trying to use Firebase for a simple CRUD android app, but while instantiation of a Firebase database reference, I encounter the following exception at runtime:
java.lang.RuntimeException: Uncaught exception in Firebase Database runloop (3.0.0). Please report to firebase-database-client#google.com
at com.google.firebase.database.android.AndroidPlatform$1$1.run(com.google.firebase:firebase-database##16.1.0:98)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
....
....
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/FirebaseApp$IdTokenListener;
....
....
at com.satwick.employeecrud.MainActivity.onCreate(MainActivity.java:76)
I went through StackOverflow, and although there have been many cases of NoClassDefFoundError in Firebase, none of them were about IdTokenListener. What I mainly realized is this might've been an error of missing some steps, while setting up the Firebase database. So I rechecked all steps:
Ensured my app is registered with the Firebase project, with correct signing SHA1.
google-services.json is included in my app directory.
firebase is correctly loaded in the application's and project's gradle files. (I can complete phone number authentication for now, so I'm pretty sure.)
In the onCreate() method:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Initialize Firebase Auth
mFirebaseAuth = FirebaseAuth.getInstance();
mFirebaseUser = mFirebaseAuth.getCurrentUser();
if (mFirebaseUser == null) {
List<AuthUI.IdpConfig> providers = Arrays.asList(new AuthUI.IdpConfig.PhoneBuilder().build());
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(providers)
.build(),
RC_SIGN_IN);
} else {
mUsername = mFirebaseUser.getDisplayName();
}
// MainActivity.java:76 The following line causes the exception.
mFirebaseDatabaseReference = FirebaseDatabase.getInstance().getReference();
}
Is this a bug with Firebase? Or am I doing something wrong?
Please help.
Also, I don't know if this is related or not, but I have two applications registered with the same Firebase project, with the same signing key (Android Studio's default SHA1.)
EDIT 1 -
Adding dependencies {} of build.gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha07'
// Google
implementation 'com.google.android.gms:play-services-auth:16.0.1'
// Firebase
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation platform('com.google.firebase:firebase-bom:17.0.0')
implementation 'com.google.firebase:firebase-database'
implementation 'com.google.firebase:firebase-storage'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
// Firebase UI
implementation 'com.firebaseui:firebase-ui-database:3.3.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
I was using some unwanted libraries in build.gradle, so cleared off the clutter to the following imports for Firebase:
// Firebase
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-auth:17.0.0'
// Firebase UI
implementation 'com.firebaseui:firebase-ui-auth:5.0.0'
implementation 'com.firebaseui:firebase-ui-database:5.0.0'
Consequently, I tried updating the version of firebase-ui from 4.3.1 -> 5.0.0, and it worked.
I tried downgrading my version from
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
to
implementation 'com.firebaseui:firebase-ui-auth:4.3.0'
and
implementation 'com.google.firebase:firebase-database:19.2.0'
to
implementation 'com.google.firebase:firebase-database:16.0.4'
and it worked
The problem basically is that when trying to RecyclerView in the class I get error "Can not resolve symbol" RecycleView "
This is my gradle code
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.android.support:recyclerview-v7:28.0.+'
This is my class
package com.example.admin.economizate;
public class ViewHolder extends RecyclerView{
}
A ViewHolder should not extend a RecyclerView, but you need an import statement regardless
You would want
import android.support.v7.widget.RecyclerView.ViewHolder;
public class YourViewHolder extends RecyclerView.ViewHolder {
Note: You already have implementation 'com.android.support:recyclerview-v7:28.0.0', so remove the recyclerview-v7:28.0.+' line
I am learning how to use Dagger2. I created an example as shown below in the code. the issue I am facing is, the auto generated class by Daggers, the one
that should be called "DaggerInterfaceComponent" is never gets created. The below DaggerInterfaceComponent is underscored with red.
Please have a look at the build gradle App posted below.
code:
InterfaceComponent component = DaggerInterfaceComponent.builder().objectValuesModule(new ObjectValuesModule()).build();
Object injectedObject = component.getObjectValues();
int returnedInt = injectedObject.getreturnInteger();
int returnedStr = injectedObject.getReturnString();
int returnedObj = injectedObject.getReturnObject();
gradle App
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-
core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile "com.google.dagger:dagger:2.11"
annotationProcessor "com.google.dagger:dagger-compiler:2.11"
provided 'javax.annotation:jsr250-api:1.0'
compile 'javax.inject:javax.inject:1'
}