Android - the ability to use AppCompatActivity without library support

In my application, build.gradledependencies:

compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.android.support:support-v13:22.0.0'
compile 'com.android.support:palette-v7:22.0.0'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:percent:22.2.0'
compile 'com.google.android.gms:play-services:7.0.0'

Without, compile 'com.android.support:appcompat-v7:22.0.0'I can still use AppCompatActivityand ActionBarwhich of the v7 support library. Any answers explaining the reasons would be appreciated :)

+4
source share
2 answers

You are using

compile 'com.android.support:design:22.2.1'

He has a dependency on 'com.android.support:appcompat-v7:22.2.1'

This means that your project has the appcompat library as well, unless you added it to build.gradle, so you can use AppCompatActivityandActionBar

Here's the pom file:

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.android.support</groupId>
  <artifactId>design</artifactId>
  <version>22.2.1</version>
  <packaging>aar</packaging>
  <dependencies>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>appcompat-v7</artifactId>
      <version>22.2.1</version>
      <type>aar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-v4</artifactId>
      <version>22.2.1</version>
      <type>aar</type>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>

gradle dependencies.
. (src: gradle )

+5

,

compile 'com.android.support:design:23.1.1'

compile 'com.android.support:appcompat-v7:23.1.1'
0

Source: https://habr.com/ru/post/1626509/


All Articles