Closed gfrileux closed 5 years ago
Just adding to this, it seems like this is more complex, and due to a combination of libraries. I am also using Firebase, and a bunch of other tools:
"dependencies": {
"@mapbox/react-native-mapbox-gl": "^6.1.3",
"@ptomasroos/react-native-multi-slider": "^1.0.0",
"@react-native-community/netinfo": "^2.0.0",
"adm-zip": "^0.4.13",
"appcenter": "1.10.0",
"appcenter-analytics": "1.10.0",
"axios": "^0.18.0",
"card-validator": "^6.1.0",
"form-data": "^2.3.3",
"i18next": "^12.0.0",
"install": "^0.12.2",
"lodash": "^4.17.11",
"moment": "^2.23.0",
"moment-timezone": "^0.5.25",
"plist": "^3.0.1",
"prop-types": "^15.6.2",
"react": "16.6.1",
"react-i18next": "^8.3.8",
"react-native": "0.57.5",
"react-native-animatable": "^1.3.2",
"react-native-appsflyer": "^1.4.2",
"react-native-auth0": "^1.3.1",
"react-native-calendar-picker": "^5.22.0",
"react-native-code-push": "^5.6.0",
"react-native-collapsible": "^1.4.0",
"react-native-device-info": "^0.24.3",
"react-native-fbsdk": "^0.8.0",
"react-native-firebase": "^5.1.1",
"react-native-gesture-handler": "^1.2.1",
"react-native-image-crop-picker": "^0.22.0",
"react-native-image-picker": "^0.28.0",
"react-native-localize": "^1.1.2",
"react-native-looped-carousel": "^0.1.13",
"react-native-modal-datetime-picker": "^6.0.0",
"react-native-permissions": "^1.1.1",
"react-native-popup-menu": "^0.14.1",
"react-native-push-notification": "^3.1.2",
"react-native-shadow": "^1.2.2",
"react-native-simple-radio-button": "^2.7.3",
"react-native-slot-machine": "^0.3.2",
"react-native-snap-carousel": "^3.7.5",
"react-native-sound": "^0.10.12",
"react-native-splash-screen": "^3.2.0",
"react-native-svg": "^9.2.4",
"react-native-view-more-text": "^2.0.1",
"react-native-youtube": "^1.1.0",
"react-navigation": "^3.0.0",
"react-redux": "^5.1.1",
"redux": "^4.0.1",
"redux-devtools-extension": "^2.13.7",
"redux-thunk": "^2.3.0",
"rn-placeholder": "^2.0.0",
"tipsi-stripe": "^7.1.0",
"uuid": "^3.3.2",
"xcode": "^1.0.0"
},
Full build.gradle:
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
maven { url "https://maven.fabric.io/public" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.firebase:firebase-plugins:1.1.5' // Used for Firebase Performance
classpath 'io.fabric.tools:gradle:1.27.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
subprojects {
}
}
and full app > build.gradle
apply plugin: "com.android.application"
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation
* entryFile: "index.android.js",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "xxxx"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "3.7"
multiDexEnabled true
sourceCompatibility = 1.8
targetCompatibility = 1.8
vectorDrawables.useSupportLibrary = true
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
debug {
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation project(':react-native-code-push')
implementation project(':react-native-localize')
implementation project(':react-native-sound')
implementation project(':react-native-appsflyer')
implementation project(':react-native-youtube')
implementation project(':@react-native-community_netinfo')
implementation project(':react-native-splash-screen')
implementation project(':react-native-svg')
implementation project(':appcenter-analytics')
implementation project(':appcenter')
implementation project(':react-native-image-crop-picker')
implementation project(':react-native-image-picker')
implementation project(':react-native-push-notification')
implementation project(':react-native-firebase')
implementation project(':react-native-device-info')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-fbsdk')
implementation project(':react-native-auth0')
implementation 'com.facebook.fresco:fresco:1.12.0'
implementation 'com.facebook.fresco:animated-gif:1.12.0'
// compile 'com.facebook.fresco:animated-gif:1.3.0'
implementation project(':tipsi-stripe')
implementation "com.google.android.gms:play-services-base:16.0.1"
implementation "com.google.android.gms:play-services-maps:16.0.0"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation(project(':@mapbox_react-native-mapbox-gl')) {
implementation ('com.squareup.okhttp3:okhttp:3.12.1') {
force = true
}
}
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
implementation 'com.google.android.gms:play-services-tagmanager:16.0.6'
implementation 'com.google.firebase:firebase-perf:16.2.3'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
It's looking like in our current version, some dependencies are using androidx (such as com.google.android.gms:play-services-base
and com.google.firebase
) while others such as maxbox rely on com.android.support
I tried using jetifier and useAndroidX=true in the gradle.properties but this causes the build of mapbox to crash (it says it cannot fin com.android.support), and so does forcing an appComponent value in the Manifest(using tools:replace).
Am not quite sure what to do next. Is there a way to make mapbox build correctly when useAndroidX=true is enabled ?
Thanks !
@vinoa-team Currently getting the same issue. Tried the same fixes to no avail.
RN is moving to AndroidX in v60. While this repo is no longer maintained and likely won’t support AndroidX (see readme), the new repo will support v60 down the line. Closing.
Hi @kristfal thanks for the reply. @alex-kofman let me know if you still have issues. We managed to get the project back on track by cheating somewhat and explicitly overwriting the class imports that rely on the old Android librairies with their corresponding AndroidX counterpart. We did it for Mapbox and a few other libraries and it works great
Hi @vinoa-team , I’ve been having the same problem. This repo is actually our only dependency that’s incompatible with Jetifier, and for business reasons we can’t upgrade to the new one right now. Would you be able to pass along which modifications you made to Mapbox’s import declarations to get it building with AndroidX? I’d really appreciate it - been tearing my hair out!
@naftalibeder - sure thing, I actually ended up making it into a Medium article, available here : https://itnext.io/react-native-how-to-handle-an-app-with-both-pre-androidx-and-androidx-dependencies-rn60-bf4df7ea0dd2 Let me know if that doesn't help!
Thanks so much for this! Your article actually led me to find this tool:
https://github.com/mikehardy/jetifier
which automatically updates import statements for all dependencies. I set
it up to run after npm install
and it worked perfectly. Might be worth
adding that to the article.
Thanks for pointing me in the right direction. :)
On Fri, Oct 18, 2019 at 9:10 AM Greg Frileux notifications@github.com wrote:
@naftalibeder https://github.com/naftalibeder - sure thing, I actually ended up making it into a Medium article, available here : https://itnext.io/react-native-how-to-handle-an-app-with-both-pre-androidx-and-androidx-dependencies-rn60-bf4df7ea0dd2 Let me know if that doesn't help!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nitaliano/react-native-mapbox-gl/issues/1641?email_source=notifications&email_token=AASPT6YOJ3STXM22WTCOSBLQPG7TRA5CNFSM4HY7NVTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBUTCSI#issuecomment-543764809, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASPT67E4H2VZGNY7TOU3HLQPG7TRANCNFSM4HY7NVTA .
Hi all,
If anyone could help I'd be grateful, as I'm still seeing the issue during a build running the command
react-native run-android
:Here is my package.json:
Here is the android > build.gradle :
Here is my app > build.gradle
Have tried to do `rm -rf node_modules/ && npm i" and start form clean but am still seeing the issue. Same thing on our CI tool. Help !!
Originally posted by @vinoa-team in https://github.com/nitaliano/react-native-mapbox-gl/issues/1538#issuecomment-503075846