I was getting an error while building nativescript app.
D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
com.android.build.api.transform.TransformException: Error while generating the main dex list:
Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy
I was getting an error while building nativescript app.
D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy
FAILURE: Build failed with an exception.
my package.json "dependencies": { "moment": "2.22.2", "nativescript-accordion": "6.0.0-beta.2", "nativescript-advanced-webview": "^3.0.2", "nativescript-appavailability": "1.3.1", "nativescript-appversion": "1.4.1", "nativescript-calendar": "2.0.1", "nativescript-cardview": "3.1.1", "nativescript-cfalert-dialog": "1.0.12", "nativescript-checkbox": "3.0.3", "nativescript-downloader": "^2.1.4", "nativescript-email": "1.5.3", "nativescript-epub-reader": "^1.0.0", "nativescript-exoplayer": "^3.4.1", "nativescript-fancyalert": "3.0.6", "nativescript-feedback": "1.3.1", "nativescript-floatingactionbutton": "5.0.0", "nativescript-fresco": "5.1.0", "nativescript-google-maps-sdk": "2.6.1", "nativescript-image-cache-it": "4.0.9", "nativescript-image-zoom": "^3.0.3", "nativescript-insomnia": "1.2.2", "nativescript-iqkeyboardmanager": "1.3.0", "nativescript-loading-indicator": "2.4.0", "nativescript-local-notifications": "2.0.3", "nativescript-onesignal": "1.0.7", "nativescript-openfile": "0.0.12", "nativescript-orientation": "2.2.1", "nativescript-pdf-view": "2.0.1", "nativescript-permissions": "1.2.3", "nativescript-phone": "1.4.0", "nativescript-picker": "^2.0.0", "nativescript-plugin-firebase": "^8.3.2", "nativescript-screen-orientation": "2.0.0", "nativescript-social-share": "^1.5.1", "nativescript-sqlite": "2.2.3", "nativescript-status-bar": "^1.1.1", "nativescript-theme-core": "^1.0.4", "nativescript-ui-calendar": "3.10.0", "nativescript-ui-dataform": "3.9.1", "nativescript-ui-listview": "^5.0.0", "nativescript-ui-sidedrawer": "^5.0.1", "nativescript-urlhandler": "^1.2.3", "tns-core-modules": "^5.0.5", "tns-platform-declarations": "4.2.1" }, "devDependencies": { "awesome-typescript-loader": "~5.2.1", "babel-traverse": "^6.26.0", "babel-types": "^6.26.0", "babylon": "6.18.0", "clean-webpack-plugin": "~0.1.19", "copy-webpack-plugin": "~4.5.3", "css-loader": "~1.0.0", "eslint": "~5.7.0", "extract-text-webpack-plugin": "~3.0.2", "lazy": "1.0.11", "nativescript-dev-sass": "^1.7.0", "nativescript-dev-typescript": "^0.7.4", "nativescript-dev-webpack": "^0.16.2", "nativescript-worker-loader": "~0.9.1", "raw-loader": "~0.5.1", "resolve-url-loader": "~3.0.0", "sass-loader": "7.1.0", "typescript": "^2.8.3", "uglifyjs-webpack-plugin": "2.0.1", "webpack": "^4.20.2", "webpack-bundle-analyzer": "3.0.2", "webpack-sources": "1.3.0" }
my app.gradle
android {
resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == 'com.android.support') { if (!requested.name.startsWith("multidex")) { details.useVersion '27.1.0' } }
} } defaultConfig {
}
aaptOptions {
additionalParameters "--no-version-vectors" }
project.ext { googlePlayServicesVersion = "16.0.0" } project.ext { supportVersion = "27.1.0" } dexOptions { jumboMode true javaMaxHeapSize "4g"
}
def settingsGradlePath
if(project.hasProperty("appResourcesPath")){ settingsGradlePath = "$project.appResourcesPath/Android/settings.gradle"; } else { settingsGradlePath = "$rootDir/../../app/App_Resources/Android/settings.gradle"; }
def settingsGradleFile = new File(settingsGradlePath);
if(settingsGradleFile.exists()) { apply from: settingsGradleFile; }
dependencies { compile(name:'mobilertc', ext:'aar'); compile(name:'commonlib', ext:'aar'); compile(name:'zoomcustomactivity', ext:'aar');
compile 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'; compile 'com.google.android.gms:play-services-gcm:15.0.1'; compile 'com.google.android.gms:play-services-location:15.0.1'; compile 'com.google.android.gms:play-services-maps:15.0.1'; compile 'com.android.support:design:27.1.0'; compile 'com.github.angads25:filepicker:1.1.1'; }