26

I am moving my first steps with app programming.

I searched the other topics that relate to this matter and tried all the solutions but still it's driving me mad:

building on Android Studio I cannot make it through this error about

implementation 'com.android.support:appcompat-v7:28.0.0' :

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).

Found versions 28.0.0, 26.1.0.

Examples include

com.android.support:animated-vector-drawable:28.0.0

and

com.android.support:support-v4:26.1.0

There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).

if i ignore it with the command "noinspection" then the apk does not run on my phone. I tried to add some dependencies like in the example line but it doesn't work at this point i show above, because if add "support version 4:26.1.0 it tells me it's not the latest and if i upgrade it writing 7:28.0.0 it doesn't work either.

Can anyone help me please? Thank you for your time!

Edit: this is my build.gradle https://www.dropbox.com/sh/1vjmrh196bdy5gn/AADW-DG1YB10s-Csw_UrZtuYa?dl=0

I applied suggestions below (THANKS!!) and the error is not showing anymore, BUT my app still crashes both in emulator and in my device (galaxy a6+).

Black Box
  • 263
  • 1
  • 3
  • 7
  • 1
    check your build tool version, target sdk as well. These type also should be same vesrion like 28.0.... and all other supporting libraries also should be varient of 28.0... – PushpikaWan Nov 01 '18 at 03:14
  • 3
    without the `dependencies` from the `build.gradle`, this is an error description alike "it's not working"; we do not want to guess what's inside the black box. and there are quite some dupes, just cannot vote to close it because none of them has an accepted answer. right now, its is "unclear what you are asking". provide more details. – Martin Zeitler Nov 01 '18 at 03:18
  • 1
    Check your transitive dependencies https://stackoverflow.com/questions/39008887/how-do-i-show-dependencies-tree-in-android-studio/39020703#39020703 – OneCricketeer Nov 01 '18 at 03:53
  • thank you for the reply. I will paste my build.gradle editing the question. – Black Box Nov 02 '18 at 23:09

4 Answers4

37

add implementation 'com.android.support:support-v4:28.0.0' in your gradle

as an old version of com.android.support:support-v4:26.1.0 is there imported by some other library which is causing the issue with com.android.support:appcompat-v7:28.0.0, similarly add the other implementations that occur after this one. so final would be like

implementation 'com.android.support:appcompat-v7:28.0.0' 
implementation 'com.android.support:support-v4:28.0.0'
  • Should probably be appcomat-v7, not just support-v4 – OneCricketeer Nov 01 '18 at 03:55
  • I just gave him the solution to prevent crash(in case it does) and remove the warning rest is up to him whatever extra he wants to add – Er. Pratik Chatterjee Nov 01 '18 at 04:02
  • thanks! the error is gone but unfortunately my app's continuously crashing and don't know why. – Black Box Nov 02 '18 at 23:29
  • If the answer resolved ur issue can you accept the answer? And post the log so that i can help u out for the crash – Er. Pratik Chatterjee Nov 02 '18 at 23:31
  • sorry but i don't really well understand the mechanics in this forum. Yes i figured out the error but my app is still not working. Should I open another topic? I don't undestand how to "accept" an answer and post some "log" – Black Box Nov 02 '18 at 23:50
  • There must be a green tick in the left side of the answer click on one which u accept and its better to ask a question which is having a differnt issue as new question instead of posting in an already mentioned topic with other prob – Er. Pratik Chatterjee Nov 02 '18 at 23:55
  • Thank you!! Will do it immediately. – Black Box Nov 03 '18 at 13:28
  • Great. Do you need any more help – Er. Pratik Chatterjee Nov 03 '18 at 13:37
  • Sorry for the late reply but unfortunately I do not get to work to this everyday. Yes I do need some more help please. My app still is not running and i can't really understand why. I wrote a new question as you suggested but nobody did answer. Leaving the link here, if you can maybe take a look and tell me if had done wrong or something. thank you so much. https://stackoverflow.com/questions/53132099/building-apk-successful-but-crashes-on-devices-and-emulator – Black Box Nov 08 '18 at 14:02
5

add the below implementation in gradle file :

implementation 'com.android.support:support-annotations:28.0.0'
kumud kala
  • 117
  • 6
3

You must update your

compileSdkVersion 28   &   targetSdkVersion 28

then Use

   implementation 'com.android.support:appcompat-v7:28.0.0'
   implementation 'com.android.support:design:28.0.0'

This is the stable release of Support Library 28.0.0 and is suitable for use in production. This will be the last feature release under the android.support packaging, and developers are encouraged to migrate to AndroidX.

Sheharyar Ejaz
  • 2,808
  • 1
  • 14
  • 15
-1

compileSdkVersion 28 & targetSdkVersion 28

change