react-native-pdf icon indicating copy to clipboard operation
react-native-pdf copied to clipboard

Android build error on latest version [email protected]

Open dgrover-spotnana opened this issue 10 months ago • 28 comments

What react-native version are you using? 0.72.12

What react-native-pdf version are you using? 6.7.5

What react-native-blob-util version are you using? 0.19.9

What platform does your issue occur on? (android/ios/both) android

Describe your issue as precisely as possible :

  1. Steps to reproduce the issue or to explain in which case you get the issue
yarn add react-native-pdf react-native-blob-util
yarn android
  1. Interesting logs
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkStagingDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
 > 2 issues were found when checking AAR metadata:
   
     1.  Dependency 'androidx.core:core-ktx:1.12.0' requires libraries and applications that
         depend on it to compile against version 34 or later of the
         Android APIs.
   
         :app is currently compiled against android-33.
   
         Also, the maximum recommended compile SDK version for Android Gradle
         plugin 7.4.2 is 33.
   
         Recommended action: Update this project's version of the Android Gradle
         plugin to one that supports 34, then update this project to use
         compileSdkVerion of at least 34.
   
         Note that updating a library or application's compileSdkVersion (which
         allows newer APIs to be used) can be done separately from updating
         targetSdkVersion (which opts the app in to new runtime behavior) and
         minSdkVersion (which determines which devices the app can be installed
         on).
   
     2.  Dependency 'androidx.core:core:1.12.0' requires libraries and applications that
         depend on it to compile against version 34 or later of the
         Android APIs.
   
         :app is currently compiled against android-33.
   
         Also, the maximum recommended compile SDK version for Android Gradle
         plugin 7.4.2 is 33.
   
         Recommended action: Update this project's version of the Android Gradle
         plugin to one that supports 34, then update this project to use
         compileSdkVerion of at least 34.
   
         Note that updating a library or application's compileSdkVersion (which
         allows newer APIs to be used) can be done separately from updating
         targetSdkVersion (which opts the app in to new runtime behavior) and
         minSdkVersion (which determines which devices the app can be installed
         on).

dgrover-spotnana avatar Apr 25 '24 16:04 dgrover-spotnana

Getting same error!

k-saparia avatar Apr 28 '24 16:04 k-saparia

I also meet the issue Do i need upgrade my compilSDK version?

tmKnight01 avatar Apr 29 '24 04:04 tmKnight01

I am also facing the same issue. Any resolution made?

prashanthkumar1993 avatar Apr 30 '24 03:04 prashanthkumar1993

I was getting the same error. I tried update compileSdkVersion to 34, but I had some problems with kotlin version. I prefered use a previous version and it is working fine.

Lucasmg37 avatar Apr 30 '24 18:04 Lucasmg37

the build succeed when i change minSdk to 24, but i don't want to change

Kaung-Htet-Hein avatar May 03 '24 09:05 Kaung-Htet-Hein

Is there any solution?

khokanuzzman avatar May 05 '24 08:05 khokanuzzman

the build succeed when i change minSdk to 24, but i don't want to change

not working for me.

khokanuzzman avatar May 05 '24 08:05 khokanuzzman

the build succeed when i change minSdk to 24, but i don't want to change

not working for me.

can you try changing compileSDK and targetSDK to 34?

Kaung-Htet-Hein avatar May 06 '24 02:05 Kaung-Htet-Hein

the build succeed when i change minSdk to 24, but i don't want to change

not working for me.

can you try changing compileSDK and targetSDK to 34?

which gradle version did you use? i am using gradle-7.5.1-all.zip

khokanuzzman avatar May 06 '24 05:05 khokanuzzman

Yes, it's working. I have just changed the compile SDK to 34.

khokanuzzman avatar May 06 '24 06:05 khokanuzzman

I was getting the same error. I tried update compileSdkVersion to 34, but I had some problems with kotlin version. I prefered use a previous version and it is working fine.

which version did use im getting the same error

"react-native-pdf": "6.7.4",

Lucasmg37 avatar May 08 '24 14:05 Lucasmg37

I think, updating gradle or compileSdkVersion is not going to be solid solution and with that being said, other dependency might stop working and library itself should be compatible with new react-native releases.

cc: @wonday

k-saparia avatar May 09 '24 17:05 k-saparia

I read the source and saw implementation 'io.legere:pdfiumandroid:1.0.19' in that package from android is using core.ktx:1.12.0 @wonday

mduc-dev avatar May 15 '24 03:05 mduc-dev

Getting same error, can anyone provide exact solution for it? @wonday

ganpatmalekar avatar May 17 '24 16:05 ganpatmalekar

the build succeed when i change minSdk to 24, but i don't want to change I changed it to 24, but some other functions failed. Is there any final solution @Kaung-Htet-Hein

Jidahan avatar May 21 '24 07:05 Jidahan

I am also facing the same issue. Any resolution made?

chanakanaveen avatar May 22 '24 11:05 chanakanaveen

I am also facing the same issue. Any resolution made?

after removing react-native-pdf and react-native-blob-util from package.json and run npm i after app build successful without errors

chanakanaveen avatar May 22 '24 12:05 chanakanaveen

Same issue here as well.

ibovegar avatar May 23 '24 07:05 ibovegar

I had the same issues, downgrading the version working fine for me

yarn add [email protected]

and added android/app/build.gradle android{ packagingOptions { pickFirst 'lib/x86/libc++_shared.so' pickFirst 'lib/x86_64/libjsc.so' pickFirst 'lib/arm64-v8a/libjsc.so' pickFirst 'lib/arm64-v8a/libc++_shared.so' pickFirst 'lib/x86_64/libc++_shared.so' pickFirst 'lib/armeabi-v7a/libc++_shared.so' } }

ils-anwarshah avatar May 31 '24 07:05 ils-anwarshah

I changed my minSdk to 24 and the compileSdk,targetSdk to 34 in android/build.gradle file and it builds fine even when the react-native-pdf version is 6.7.5

saisrinivas-nineleaps avatar Jun 07 '24 04:06 saisrinivas-nineleaps

I had the same issues, downgrading the version working fine for me

yarn add [email protected]

and added android/app/build.gradle android{ packagingOptions { pickFirst 'lib/x86/libc++_shared.so' pickFirst 'lib/x86_64/libjsc.so' pickFirst 'lib/arm64-v8a/libjsc.so' pickFirst 'lib/arm64-v8a/libc++_shared.so' pickFirst 'lib/x86_64/libc++_shared.so' pickFirst 'lib/armeabi-v7a/libc++_shared.so' } }

it worked!! ty so much

NewDawnFades21 avatar Jun 18 '24 07:06 NewDawnFades21

Can you guys confirm what version of react-native-blob-util are you using?? Downgrading to 6.6.2 seams to fix part of the problem for me, but then got Execution failed for task ':react-native-blob-util:processDebugManifest'.

migtarx avatar Jun 25 '24 17:06 migtarx

Can you guys confirm what version of react-native-blob-util are you using?? Downgrading to 6.6.2 seams to fix part of the problem for me, but then got Execution failed for task ':react-native-blob-util:processDebugManifest'.

"react-native-blob-util": "^0.19.9", "react-native": "0.72.0",

ils-anwarshah avatar Jun 26 '24 06:06 ils-anwarshah

image

Try this in your app.json / app.config.js

[
       "expo-build-properties",
        {
          "android": {
            "compileSdkVersion": 34,
            "targetSdkVersion": 34,
            "buildToolsVersion": "34.0.0"
          }
        }
]

sunilksamanta avatar Jun 28 '24 05:06 sunilksamanta

Maybe not the best solution, but downgraded to the first compatible version of RN 0.62 of both react-native-blob-util (0.13.7) and react-native-pdf (6.4.0) due to my project is in version 0.68 of RN and currently cant upgrade to more recent versions and cant even touch the compileSdkVersion because it breaks my project. With react-native-blob-util (0.13.7) and react-native-pdf (6.4.0) i'm working perfectly fine. Maybe some of you can try with more recent versions.

migtarx avatar Jun 28 '24 21:06 migtarx

I had the same issues, downgrading the version working fine for me

yarn add [email protected]

and added android/app/build.gradle android{ packagingOptions { pickFirst 'lib/x86/libc++_shared.so' pickFirst 'lib/x86_64/libjsc.so' pickFirst 'lib/arm64-v8a/libjsc.so' pickFirst 'lib/arm64-v8a/libc++_shared.so' pickFirst 'lib/x86_64/libc++_shared.so' pickFirst 'lib/armeabi-v7a/libc++_shared.so' } }

This works for me which changing amy other config. my RN ver is: 0.72.7

rahul7007 avatar Jul 16 '24 09:07 rahul7007

For me the fix was removing the package name in node_modules/react-native-pdf/android/src/main/AndroidManifest.xml and adding that same namespace in node_modules/react-native-pdf/android/build.gradle like this:

android {
    namespace "org.wonday.pdf"
...
}

MarioSilvaPrada avatar Jul 24 '24 17:07 MarioSilvaPrada

I changed my minSdk to 24 and the compileSdk,targetSdk to 34 in android/build.gradle file and it builds fine even when the react-native-pdf version is 6.7.5

this is the best and full proof solution in my opinion. every one must try this one. and thanx @saisrinivas-nineleaps

ar-jamal avatar Aug 16 '24 10:08 ar-jamal