Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue compiling android #128

Closed
phyzical opened this issue Jun 18, 2019 · 14 comments
Closed

Issue compiling android #128

phyzical opened this issue Jun 18, 2019 · 14 comments
Labels
platform: Android This is Android specific

Comments

@phyzical
Copy link

phyzical commented Jun 18, 2019

Cant build once adding the includes for async in android configs get the below warning before building

dependencies using groupId com.android.support and androidx.* can not be combined but found IdeMavenCoordinates{myGroupId='com.android.support', myArtifactId='drawerlayout', myVersion='28.0.0', myPacking='aar', myClassifier='null'} and IdeMavenCoordinates{myGroupId='androidx.core', myArtifactId='core', myVersion='1.0.0', myPacking='aar', myClassifier='null'}

and the following on attempting to build

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:15:5-57:19 to override.

Expected behavior

compile

Environment

     compileSdkVersion 28
     buildToolsVersion '28.0.3'

implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation "com.android.support:appcompat-v7:28.0.0"
implementation project(':@react-native-community_async-storage')
"@react-native-community/async-storage": "^1.5.0",

i understand it should be able to change androidx to fix the issue which i tried but i have too many dependencies that are not compatible i think.

Removing the references to async fixes the warnings and it compiles

am i forced to start deprecating these and replacing them with my own code or should i maybe rollback the integration of the new async implementation for now?

IOS builds fine

Thanks!

@krizzu krizzu added the platform: Android This is Android specific label Jun 18, 2019
@krizzu
Copy link
Member

krizzu commented Jun 18, 2019

Hi @phyzical ,

What version of RN you're trying to use? Do you have any other implementation that could use androidx?

As you can see here, AsyncStorage is not relying on any deps, but RN.

thanks.

@krizzu krizzu added LEGACY and removed LEGACY labels Jun 18, 2019
@phyzical
Copy link
Author

phyzical commented Jun 19, 2019

Hey thanks for the speedy Reply!

i might here is the full npm list i know its a tad large...

RN 59.9

"dependencies": {
    "array.chunk": "1.1.0",
    "camelcase-keys": "4.2.0",
    "crypto-js": "3.1.9-1",
    "link": "0.1.5",
    "moment": "2.22.0",
    "moment-precise-range-plugin": "1.3.0",
    "moment-timezone": "0.5.16",
    "prop-types": "^15.6.2",
    "react": "16.8.3",
    "react-dom": "^16.8.6",
    "react-native": "^0.59.9",
    "react-native-app-settings": "^2.0.1",
    "react-native-config": "^0.11.7",
    "react-native-contacts": "^3.0.0",
    "react-native-contacts-wrapper": "^0.2.4",
    "react-native-datepicker": "1.6.0",
    "react-native-device-info": "^0.24.3",
    "react-native-elements": "^1.1.0",
    "react-native-fbsdk": "^0.8.0",
    "react-native-fbsdklogin": "^0.0.8",
    "react-native-fetch-polyfill": "1.1.2",
    "react-native-firebase": "^5.3.1",
    "react-native-fs": "^2.13.3",
    "react-native-htmlview": "0.12.1",
    "react-native-image-picker": "^0.28.0",
    "react-native-image-resizer": "^1.0.0",
    "react-native-keyboard-aware-scroll-view": "0.8.0",
    "react-native-linear-gradient": "^2.5.3",
    "react-native-modal-dropdown": "0.6.2",
    "react-native-pages": "0.6.1",
    "react-native-permissions": "^1.1.1",
    "@react-native-community/async-storage": "^1.5.0",
    "react-native-photo-upload": "1.2.0",
    "react-native-push-notification": "3.1.3",
    "react-native-restart": "^0.0.8",
    "react-native-sentry": "^0.43.1",
    "react-native-status-bar-height": "2.0.0",
    "react-native-svg": "7.2.1",
    "react-native-svg-uri": "^1.2.3",
    "react-native-swiper": "1.5.13",
    "react-native-uploader": "aroth/react-native-uploader#master",
    "react-native-vector-icons": "6.5.0",
    "react-native-view-overflow": "^0.0.4",
    "react-navigation": "1.6.1",
    "react-navigation-redux-helpers": "1.1.2",
    "react-redux": "5.0.7",
    "react-timeout": "1.1.1",
    "react-timer-mixin": "0.13.3",
    "redux": "3.7.2",
    "redux-logger": "3.0.6",
    "snakecase-keys": "1.1.1"
  },
  "devDependencies": {
    "apidoc-contenttype-plugin": "0.1.0",
    "@babel/plugin-external-helpers": "^7.2.0",
    "@babel/runtime": "^7.3.0",
    "babel-eslint": "9.0.0",
    "babel-jest": "24.8.0",
    "babel-plugin-module-resolver": "^3.1.1",
    "metro-react-native-babel-preset": "^0.48.5",
    "chai": "4.2.0",
    "enzyme": "3.3.0",
    "enzyme-adapter-react-16": "1.1.1",
    "enzyme-to-json": "3.3.3",
    "eslint": "5.3.0",
    "eslint-config-airbnb": "17.1.0",
    "eslint-plugin-import": "2.14.0",
    "eslint-plugin-jsx-a11y": "6.2.1",
    "eslint-plugin-react": "7.13.0",
    "jest": "24.8.0",
    "jest-cli": "24.8.0",
    "jsdom": "15.1.1",
    "jsdom-global": "3.0.2",
    "jsx-chai": "4.0.0",
    "react-addons-test-utils": "16.0.0-alpha.3",
    "react-shallow-testutils": "3.0.1",
    "react-test-renderer": "16.8.6",
    "react-test-utils": "^0.0.1",
    "redux-devtools-extension": "2.13.8"
  },
dependencies {
    implementation (project(':react-native-device-info')) {
        exclude group: 'com.google.android.gms'
    }
    implementation project(':react-native-view-overflow')
    implementation project(':react-native-app-settings')
    implementation project(':react-native-config')
    implementation project(':react-native-sentry')
    implementation project(':react-native-contacts')
    implementation project(':react-native-image-resizer')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-svg')
    implementation project(':react-native-linear-gradient')
    implementation project(':react-native-restart')
    implementation project(':react-native-push-notification')
    implementation project(':react-native-image-picker')
    implementation project(':react-native-fs')
    implementation project(':react-native-fbsdk')
    implementation project(':react-native-contacts-wrapper')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    /*implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.browser:browser:1.0.0'
    implementation 'androidx.media:media:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.0.0'*/

    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:customtabs:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation "com.android.support:appcompat-v7:28.0.0"
    implementation project(':@react-native-community_async-storage')

    implementation "com.facebook.android:facebook-android-sdk:4.39.0"
    implementation 'com.google.android.gms:play-services-base:16.1.0'
    implementation 'com.google.android.gms:play-services-gcm:16.1.0'
    implementation "com.facebook.react:react-native"  // From node_modules
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.google.firebase:firebase-messaging:17.5.0'
    implementation project(':react-native-firebase')
}

i have been spending the last week bringing this app back to life haha, fixed it all and decided to get ride of the "last deprecation warning" >.>

as for "if its another implementation" i dont think so.. ((but i could be wrong)) as syncing the gradle once the configs for the new Async implementation are removed fixed the android x warning

@krizzu
Copy link
Member

krizzu commented Jun 19, 2019

@phyzical The issue here is that you're mixing com.android.support libs with androidx libs.

Try using com.android.support only, see if that helps.

@phyzical
Copy link
Author

Hey,

maybe i didnt make it clear,

  • i dont use android x that is in a comment block (from my testing attempt)
  • these are the implementations im trying use
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:customtabs:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation "com.android.support:appcompat-v7:28.0.0"
  • the code does not complain about android x if i remove the new async plugin from android configs, so it must be async forcing this dependency right?

Do i maybe need to use an older community-async version? not 1.5.0?

@chinmaygit
Copy link

chinmaygit commented Jun 19, 2019

Same issue suddenly appear while building android prod in RN 0.59.5. I have upgraded to 0.59.9 but the problem still persists.

Downgraded lib to 1.4.1, Getting this on building

app/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java:26: error: package com.facebook.react.module.annotations does not exist import com.facebook.react.module.annotations.ReactModule;

app/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java:33: error: cannot find symbol @ReactModule(name = AsyncStorageModule.NAME)

What went wrong: Execution failed for task ':@react-native-community_async-storage:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details.

@phyzical
Copy link
Author

@chinmaygit i dont think our problems are connected maybe create a new issue

@chinmaygit
Copy link

Its very unpredictable and unstable working with RN.
i downgraded the lib and i got the above error,
then i have upgraded it again, also this time react-native-device-info, react-native-firebase and removed node_modules and re installed, it's working now.

@phyzical i got the same error as you mentioned above,
may be you want to try removing and installing node_modules.

@krizzu
Copy link
Member

krizzu commented Jun 19, 2019

Hey @phyzical,

This issue is about androidx, but it's not Async Storage dependency. It's probably your version of RN, which uses androidx (https://github.com/facebook/react-native/blob/master/ReactAndroid/build.gradle)

I believe you could try to migrate to androidx, but you already said you have too much deps to deal with, so this is pointless.

You can both (@chinmaygit 👋) check out this issue here: the facebook/react-native#25293.

Maybe the solution proposed will work for ya.

@phyzical
Copy link
Author

phyzical commented Jun 20, 2019

Hey @krizzu,

Thanks for the hand holding ;) your link sent me to here facebook/react-native#25292 (comment)

./gradlew app:dependencies is the key to debugging these issues.

in my case device info was enforcing firebase:+ so pulling 19 and then triggering androidx
once i added the ext vars it wanted the app stopped trying to be the latest and greatest.

thanks for the help im not sure why updating async caused this issue though haha.. i guess i updated device info and forgot?

anyway clear to close

if i can get my year old app with this many dependencies going on the release before androidx im sure must others can too

GL to those i feel your pains

@krizzu
Copy link
Member

krizzu commented Jun 22, 2019

@phyzical Happy to hear you solved it. :)

@nikopolidi
Copy link

I solved it by upgrading react-native packages without refactoring to androidx cause that action created cascades of issues to resolve =(
yarn upgrade --pattern react-native
So stupid but it worked

@mkamals
Copy link

mkamals commented Jun 26, 2019

Hey @krizzu,

Thanks for the hand holding ;) your link sent me to here facebook/react-native#25292 (comment)

./gradlew app:dependencies is the key to debugging these issues.

in my case device info was enforcing firebase:+ so pulling 19 and then triggering androidx
once i added the ext vars it wanted the app stopped trying to be the latest and greatest.

thanks for the help im not sure why updating async caused this issue though haha.. i guess i updated device info and forgot?

anyway clear to close

if i can get my year old app with this many dependencies going on the release before androidx im sure must others can too

GL to those i feel your pains

This really helped me to solve the issue. Thanks Bro.

@rafi5777
Copy link

rafi5777 commented Aug 8, 2019

@krizzu how can i come back com.android.support libs again..

@cmcaboy
Copy link

cmcaboy commented Sep 24, 2019

I ran into this issue when i tried to use a fork of my own version of react-native. I was able to fix the issue by following this article: https://github.com/facebook/react-native/wiki/Building-from-source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Android This is Android specific
Projects
None yet
Development

No branches or pull requests

7 participants