1

I imported a material Dialog library from Github. https://github.com/drakeet/MaterialDialog

And I imported the library in Android Studio. However, now The Android Studio says "Gradle project sync failed, basic functionality (editing, debugging) will not work properly.

I tried alternative answers to similar problems from other questions here, Gradle project sync failed?

Android Studio Gradle project sync failed

But, none works for me .

The error I get in console is : Error:Dependency ZyiaAlarm:materialDialog:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency. File: F:\ZyiaAlarm\materialDialog\build\outputs\apk\materialDialog-release-unsigned.apk

My doubt is: Any way to restore the things back, I mean to get the gradle as it was as I am a beginner, there's much to learn about gradle. OR anyway to fix this library I imported ?

Any help will be appreciated!

Community
  • 1
  • 1
Shaheen
  • 39
  • 5
  • how do you import it ?? – Sajal May 04 '15 at 07:05
  • https://github.com/MagicMicky/FreemiumLibrary/wiki/Import-the-library-in-Android-Studio [Method - 2 ] – Shaheen May 04 '15 at 07:13
  • I think your question answer is here: [how-to-import-android-project-as-library-and-not-compile-it-as-apk-android-stud][1] [1]: http://stackoverflow.com/questions/27536491/how-to-import-android-project-as-library-and-not-compile-it-as-apk-android-stud – humazed May 04 '15 at 07:13
  • leave it .. just add compile 'me.drakeet.materialdialog:library:1.2.2' in your build.gradle .. see [link](https://github.com/drakeet/MaterialDialog) step 1. using gradle. – Sajal May 04 '15 at 07:14
  • build.gradle file of project of or the module ? – Shaheen May 04 '15 at 07:22
  • then the error : Error:Dependency ZyiaAlarm:materialDialog:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency. File: F:\ZyiaAlarm\materialDialog\build\outputs\apk\materialDialog-release-unsigned.apk – Shaheen May 04 '15 at 07:26
  • build.gradle in the src folder – Sajal May 04 '15 at 07:55
  • Nope, doesn;t work! still the error! Anyway to rollback everything at once ? :( – Shaheen May 04 '15 at 08:38

1 Answers1

0

Too long for a comment.

It is not clear how do you import it.

If you would like to build locally this library, you should have this type of structure:

root
  MaterialLib
    build.gradle
  app
    build.gradle
  build.gradle
  settings.gradle

where MaterialLib is the folder MaterialDialog/library from github. You haven't to import the other folders from github.

Also in

app/build.gradle you should have:

dependencies {
    compile project(':MaterialLib')
 }

and in the settings.gradle you should have:

include ':app',':MaterialLib'

However I suggest you avoiding the local library.

Remove the MaterialLib (don't import code from github).

Just add to your app/build.gradle these lines:

dependencies {
    compile 'me.drakeet.materialdialog:library:1.2.2'
}

In this you should have this type of structure:

root
  app
    build.gradle
  build.gradle
  settings.gradle

and in the settings.gradle you should have:

include ':app'
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841