Android Multiple DEX FILES Define solves the conflict

There is a new demand during this period. Android App previews PDF online through URL. When choosing to use and importing the PdfViewPager library, the following exception was reported:

jdmerchants:transformDexArchiveWithExternalLibsDexMergerForTestServerDebug


com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

Multiple dex files define Luk
/co/senab/photoview/log/Logger

When the words Multiple, dex appear, the direct thought may be repeated Into the dependency, then the question is:

Why do I have repeated dependencies when I import the PdfViewPager library?
What files are duplicates in the PdfViewPager class library and my existing dependent class library?
How to determine which file in a certain class library and PdfViewPager class library have duplicate dependencies?

The reason for the positioning problem

I use Android Studio 3.1 under Mac for development

First of all, I need to find a tool or method to understand everything in the current project The internal dependencies of the class library. Here is a way to enter the following command

./gradlew -q Module name: dependencies

On the command line window List all dependencies of the current module. I selected the content related to this question and displayed it as follows:

\--- es.voghdev.pdfviewpager:library:1.0.3

+--- com.android.support:appcompat-v7:25.4.0< /span> (*)
\
--- com.commit451:PhotoView:1.2.4< /span>
\
--- com.android.support:support-v4:23.0.1 -> 25.4.0 (*)


\
--- com.github.chrisbanes.photoview:library:1.2.4
\
--- com.android.support:support-v4:22.0.0 -> 25.4.0 (*)

You will find that the newly introduced pdfviewpager library uses com.commit451:PhotoView:1.2.4; this is the same as the com.github.chrisbanes.photoview:library:1.2.4 library

p>

Solve the problem

The problem we found: the pdfviewpager class library relies on the chrisbanes.photoview class library, causing the chrisbanes.photoview class library to be duplicated Use, so just exclude com.commit451:PhotoView:1.2.4 when introducing pdfviewpager.

So how to exclude it? Gradle construction project must have thought of the handling in this case-when a third-party class library is introduced, one of the dependent libraries is excluded:


compile ('es.voghdev.pdfviewpager:library: 1.0.3'){

exclude group:
'com.commit451', module:'PhotoView'
}

Summary

I have encountered a problem that has not been encountered before, and the knowledge points required for this problem are not previously reserved At this time, google search to find answers to similar questions must be able to make analogy and extend knowledge, think slowly, think effectively, draw a little new conclusion, and then continue to think, you can get closer and closer to the successful path of solving the problem.

Reference material

Gradle dependency exclusion

Problems and solutions about Android Studio’s repeated introduction of packages

Learn Gradle- 5.3: Dependency-Manage dependent versions

jdmerchants:transformDexArchiveWithExternalLibsDexMergerForTestServerDebug


com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

Multiple dex files define Luk
/co/senab/photoview/log/Logger

When the words Multiple, dex appear, the direct thought may be repeated Into the dependency, then the question is here:

Why do I have repeated dependencies when I import the PdfViewPager library?
What files are duplicates in the PdfViewPager class library and my existing dependent class library?
How to determine which file in a certain class library and PdfViewPager class library have duplicate dependencies?

The reason for the positioning problem

I use Android Studio 3.1 under Mac for development

First of all, I need to find a tool or method to understand everything in the current project The internal dependencies of the class library. Here is a way to enter the following command

./gradlew -q Module name: dependencies

On the command line window List all dependencies of the current module. I selected the content related to this question and displayed it as follows:

\--- es.voghdev.pdfviewpager:library:1.0.3

+--- com.android.support:appcompat-v7:25.4.0< /span> (*)
\
--- com.commit451:PhotoView:1.2.4< /span>
\
--- com.android.support:support-v4:23.0.1 -> 25.4.0 (*)


\
--- com.github.chrisbanes.photoview:library:1.2.4
\
--- com.android.support:support-v4:22.0.0 -> 25.4.0 (*)

You will find that the newly introduced pdfviewpager library uses com.commit451:PhotoView:1.2.4; this is the same as the com.github.chrisbanes.photoview:library:1.2.4 library

p>

Solve the problem

The problem we found: the pdfviewpager class library relies on the chrisbanes.photoview class library, causing the chrisbanes.photoview class library to be duplicated Use, so just exclude com.commit451:PhotoView:1.2.4 when introducing pdfviewpager.

So how to exclude it? Gradle construction project must have thought of the handling in this case-when a third-party class library is introduced, one of the dependent libraries is excluded:


compile ('es.voghdev.pdfviewpager:library: 1.0.3'){

exclude group:
'com.commit451', module:'PhotoView'
}

Summary

I have encountered a problem that has not been encountered before, and the knowledge points required for this problem are not previously reserved At this time, google search to find answers to similar questions must be able to make analogy and extend knowledge, think slowly, think effectively, draw a little new conclusion, and then continue to think, you can get closer and closer to the successful path of solving the problem.

Reference material

Gradle dependency exclusion

Problems and solutions about Android Studio’s repeated introduction of packages

Learn Gradle- 5.3: Dependency-Manage dependent versions

./gradlew -q Module name: dependencies

\--- es.voghdev.pdfviewpager:library:1.0.3

+--- com.android.support:appcompat-v7:25.4.0< /span> (*)
\
--- com.commit451:PhotoView:1.2.4< /span>
\
--- com.android.support:support-v4:23.0.1 -> 25.4.0 (*)


\
--- com.github.chrisbanes.photoview:library:1.2.4
\
--- com.android.support:support-v4:22.0.0 -> 25.4.0 (*)

Solve the problem

The problem we found: the pdfviewpager class library relies on the chrisbanes.photoview class library, causing the chrisbanes.photoview class library to be reused, so as long as When introducing pdfviewpager, just exclude com.commit451:PhotoView:1.2.4.

So how to exclude it? Gradle construction project must have thought of the handling in this case-when a third-party class library is introduced, one of the dependent libraries is excluded:


compile ('es.voghdev.pdfviewpager:library: 1.0.3'){

exclude group:
'com.commit451', module:'PhotoView'
}

Summary

I have encountered a problem that has not been encountered before, and the knowledge points required for this problem are not previously reserved At this time, google search to find answers to similar questions must be able to make analogy and extend knowledge, think slowly, think effectively, draw a little new conclusion, and then continue to think, you can get closer and closer to the successful path of solving the problem.

Reference material

Gradle dependency exclusion

Problems and solutions about Android Studio’s repeated introduction of packages

Learn Gradle- 5.3: Dependency-Manage dependent versions

Solve the problem

The problem we found: the pdfviewpager class library relies on the chrisbanes.photoview class library, causing the chrisbanes.photoview class library to be reused, so as long as the pdfviewpager is introduced, Just exclude com.commit451:PhotoView:1.2.4.

So how to exclude it? Gradle construction project must have thought of the handling in this case-when a third-party library is introduced, a dependent library in it is excluded:


compile ('es.voghdev.pdfviewpager:library:1.0.3'){

exclude group:
'com.commit451', module:'PhotoView'
}

< div class="show-content-free">

Summary

I have encountered a problem that I have not encountered before. The knowledge points required for this problem are blind spots that have not been reserved before. At this time, Google search To find answers to similar questions, you need to be able to make analogies and extend knowledge, think slowly, think effectively, draw a little new conclusion, and then continue to think, you can get closer and closer to the successful path of solving the problem.

Reference material

Gradle dependency exclusion

Problems and solutions about Android Studio’s repeated introduction of packages

Learn from me Gradle-5.3: dependency-management dependency Version

Summary

I encountered something I hadn’t encountered before Question, the knowledge points required for this question are blind spots that have not been reserved before. At this time, google search finds the answers to similar questions to be able to make analogies and extend knowledge, think slowly, think effectively, and draw a little new conclusion, and then If you continue to think about it, you will get closer and closer to the successful path to solve the problem.

Reference materials

Gradle dependency exclusion

Questions about Android Studio’s repeated introduction of packages and Solution

Follow me to learn Gradle-5.3: dependency-manage dependent version

Summary

I have encountered a problem that I have not encountered before. The knowledge points required for this problem are blind spots that have not been reserved before. At this time, google search must be able to find answers to similar questions. By analogy and extension of knowledge, thinking slowly, thinking effectively, drawing a little new conclusion, and then continuing to think, you can get closer and closer to the successful path to solve the problem

Reference material

Gradle dependency exclusion

Problems and solutions about Android Studio’s repeated introduction of packages

Learn from me Gradle-5.3: Dependency-Manage dependent versions

Summary

I have encountered a problem that has not been encountered before, and the knowledge points required for this problem It is another blind spot that has not been reserved before. At this time, google search finds the answer to similar questions to be able to use analogy and knowledge extension, think slowly, think effectively, draw a little new conclusion, and then continue to think, you can get closer and closer. The path to success in solving the problem is here.

Reference materials

Gradle dependency exclusion

Problems and solutions about Android Studio’s repeated introduction of packages

Learn from me Gradle-5.3: Dependency-Manage dependent versions

Summary

I have encountered a problem that I have not encountered before, this problem The required knowledge points are blind spots that have not been reserved before. At this time, google search finds answers to similar questions to be able to make analogies and extend knowledge, think slowly, think effectively, draw a little new conclusion, and then continue to think. We can get closer and closer to the successful path to solve the problem

Reference material

Gradle dependency exclusion

Problems and solutions regarding the repeated introduction of packages by Android Studio

p>

Follow me to learn Gradle-5.3: dependency-manage dependent version

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3548 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.