S
S
Staspost2020-01-17 16:31:51
gradle
Staspost, 2020-01-17 16:31:51

Android Studio does not import android.support.v7 library, how to fix?

There are 2 computers with Android Studio version 3.5.3. On one of them, a small project was written, in which View.OnClickListener was implemented in the main class:

public class NameActivity extends AppCompatActivity implements View.OnClickListener {}

A supporting class has also been imported:
import android.support.v7.app.AppCompatActivity;
In this form, the code works fine.
Created a similar project on another machine - does not work. As far as I was able to understand, the newer androidx libraries are used on the second machine.
The developer guide indicates that the library I used earlier has been replaced with androidx.appcompat.app.AppCompatActivity. I have this new library imported, but with it the studio swears at "implements View.OnClickListener", and the old library can no longer be installed.
I wrote it directly in Gradle:
implementation 'com.android.support:appcompat-v7:28.0.0'

but this does not solve the problem, synchronization gives an error, swears that it is necessary to use the new androidx library. Disabling androidx support in the Gradle settings file did not solve the problem either. On the old machine, there is no androidx support in the Gradle settings.
What else can be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Vodakov, 2020-01-17
@WaterSmith

import android.support.v7.app.AppCompatActivity;
remove it, make
a gredl fix it too,

implementation 'com.android.support:appcompat-v7:28.0.0'
shouldn't be there. With androidx in the same project, they do not get along well.
And write how it swears at implements View.OnClickListener, otherwise it’s not clear what the problem is.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question