Android报错:Program type already present: android.support.v13.view.DragStartHelper$1求助
Hey there! That Program type already present error is almost always tied to duplicate or mismatched dependencies in your project—especially after updating Android Studio, which often pulls in newer library versions that clash with your existing setup. Let’s walk through targeted fixes you can try, since the steps you’ve already taken (clearing caches, reinstalling AS) didn’t resolve the root issue:
1. Hunt for duplicate support library dependencies
This is the most common culprit. Here’s how to track it down:
- Open your app-level
build.gradlefile and scan for any explicit references toandroid.support.v13or overlapping support libraries. - Run this command in your project root to generate a full dependency tree (it’ll show every library being pulled in, including transitive ones):
./gradlew app:dependencies # Use gradlew.bat app:dependencies on Windows - Look for duplicate entries of
android.support.v13:support-v13—you might see different versions or it being included by multiple third-party libraries. - If you find a conflict, exclude the duplicate module from the problematic dependency. For example:
implementation('com.example.some-third-party-lib:2.0.0') { exclude group: 'com.android.support', module: 'support-v13' }
2. Align all support library versions
Android Studio updates can silently change default support library versions, creating mismatches. Fix this by standardizing versions across your project:
- Add a version variable to your project-level
build.gradle:ext { supportLibVersion = '28.0.0' // Use the version that matches your target SDK } - Use this variable for all your support library dependencies to ensure consistency:
implementation "com.android.support:appcompat-v7:$supportLibVersion" implementation "com.android.support:support-v13:$supportLibVersion"
3. Do a full clean and rebuild
You’ve tried cache invalidation, but let’s wipe all build artifacts completely:
- Run
./gradlew clean(orgradlew clean) from the terminal to delete old build files. - Go to
File > Sync Project with Gradle Filesto refresh your dependency setup. - Rebuild with
./gradlew assembleDebugto generate fresh build artifacts.
4. Check third-party libraries for outdated dependencies
Some SDKs (like analytics, ad tools) often bundle old support libraries. Use the dependency tree command from step 1 to spot these:
- If a library is pulling in an outdated support version, either update the library to a newer release that uses compatible versions, or exclude the conflicting module as shown in step 1.
5. Migrate to AndroidX (long-term fix)
Since the Android Support Library is deprecated, migrating to AndroidX will eliminate many dependency clash issues. Android Studio has a built-in tool to make this easy:
- Go to
Refactor > Migrate to AndroidX... - Follow the prompts to update all dependencies and refactor your code to use AndroidX equivalents.
Since your project worked perfectly a month ago, the issue is definitely linked to the Android Studio update altering dependency versions. Start with the dependency tree check—it’s the fastest way to pinpoint the conflict. Good luck!
内容的提问来源于stack exchange,提问作者CodeAndWave

