1

I am going to implement google firebase messaging to my android project. Google documentation offers using dependencies. I am confused if I can import JAR files instead of dependencies or JAR and dependencies are both needed? Would importing JAR file using this method is enough?

this is Google Documentation:

dependencies {
     compile 'com.google.firebase:firebase-messaging:11.6.2'
}

and this is the list of google JAR files:

https://github.com/nsiatras/Google-Play-Firebase-jars/tree/master/Version%209.0.1/firebase

Ali Sheikhpour
  • 10,475
  • 5
  • 41
  • 82
  • First, those JARs are two years old. Second, you have no idea if those JARs are legitimate -- for all you know, they have been hacked to include malware. What is the particular problem with using dependencies? – CommonsWare Dec 01 '17 at 18:59
  • I use eclipse and I could not find the way to use dependencies in android project https://stackoverflow.com/questions/47495489/how-to-add-an-external-dependency-to-an-eclipse-project – Ali Sheikhpour Dec 01 '17 at 19:00
  • First off a jar would be insufficient, it wouldn't have the resources. You'd want .aar files. Secondly, what the dependency does is specify an exact version of the library and downloads the aar from the web. Unless you won't have web access for an extended period you won't see any advantages to not using gradle dependencies – Gabe Sechan Dec 01 '17 at 19:01
  • Google support for Eclipse ended quite some time ago. You might see if there is a newer version of Eclipse, one that supports Maven-style artifact repositories. – CommonsWare Dec 01 '17 at 19:18
  • They ended support about two years ago to be specific (I was curious so I looked it up). https://android-developers.googleblog.com/2015/06/an-update-on-eclipse-android-developer.html @AliSheikhpour In my experience Android Studio really is better, and I was an Eclipse fan. – nasch Dec 01 '17 at 19:57

1 Answers1

1

Theoretically, you can also import JAR files. However, the difficulty is to find out the dependencies of this dependency, the dependencies of the dependencies of the dependency and so on until all dependencies are resolved.

In Eclipse, you can use Eclipse Buildship to resolve Gradle dependencies.

With

repositories {
    maven {
         url 'https://maven.google.com'
    }
}

the dependency com.google.firebase:firebase-messaging:11.6.2 is resolved to following JAR/AAR files:

https://maven.google.com/com/google/firebase/firebase-messaging/11.6.2/firebase-messaging-11.6.2.aar
https://maven.google.com/com/google/firebase/firebase-iid/11.6.2/firebase-iid-11.6.2.aar
https://maven.google.com/com/google/android/gms/play-services-basement/11.6.2/play-services-basement-11.6.2.aar
https://maven.google.com/com/google/firebase/firebase-common/11.6.2/firebase-common-11.6.2.aar
https://maven.google.com/com/google/firebase/firebase-messaging-license/11.6.2/firebase-messaging-license-11.6.2.aar
https://maven.google.com/com/google/android/gms/play-services-tasks/11.6.2/play-services-tasks-11.6.2.aar
https://maven.google.com/com/google/firebase/firebase-iid-license/11.6.2/firebase-iid-license-11.6.2.aar
https://maven.google.com/com/android/support/support-v4/25.2.0/support-v4-25.2.0.aar
https://maven.google.com/com/google/android/gms/play-services-basement-license/11.6.2/play-services-basement-license-11.6.2.aar
https://maven.google.com/com/google/firebase/firebase-common-license/11.6.2/firebase-common-license-11.6.2.aar
https://maven.google.com/com/google/android/gms/play-services-tasks-license/11.6.2/play-services-tasks-license-11.6.2.aar
https://maven.google.com/com/android/support/support-compat/25.2.0/support-compat-25.2.0.aar
https://maven.google.com/com/android/support/support-media-compat/25.2.0/support-media-compat-25.2.0.aar
https://maven.google.com/com/android/support/support-core-utils/25.2.0/support-core-utils-25.2.0.aar
https://maven.google.com/com/android/support/support-core-ui/25.2.0/support-core-ui-25.2.0.aar
https://maven.google.com/com/android/support/support-fragment/25.2.0/support-fragment-25.2.0.aar
https://maven.google.com/com/android/support/support-annotations/25.2.0/support-annotations-25.2.0.jar
https://maven.google.com/com/android/support/support-compat/25.2.0/support-compat-25.2.0-sources.jar
https://maven.google.com/com/android/support/support-media-compat/25.2.0/support-media-compat-25.2.0-sources.jar
https://maven.google.com/com/android/support/support-core-utils/25.2.0/support-core-utils-25.2.0-sources.jar
https://maven.google.com/com/android/support/support-core-ui/25.2.0/support-core-ui-25.2.0-sources.jar
https://maven.google.com/com/android/support/support-fragment/25.2.0/support-fragment-25.2.0-sources.jar
https://maven.google.com/com/android/support/support-annotations/25.2.0/support-annotations-25.2.0-sources.jar 

See also: How to integrate .aar file to Eclipse

howlger
  • 31,050
  • 11
  • 59
  • 99