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

【Android】Failed to build on Android on react native 0.73.4 #2035

Open
lchenfox opened this issue Mar 20, 2024 · 5 comments
Open

【Android】Failed to build on Android on react native 0.73.4 #2035

lchenfox opened this issue Mar 20, 2024 · 5 comments

Comments

@lchenfox
Copy link

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.40.3
  • react-native v0.73.4

Platform

Tell us to which platform this issue is related

  • Android

Expected behaviour

Build and run successfully on Android

Actual behaviour

Failed to build and run on Android.

Steps to reproduce

  1. Install react-native-image-crop-picker

  2. Configure the build.gradle following the README.md docs

  3. Run the real device on Android.

Attachments

// stacktrace or any other useful debug info

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > An issue was found when checking AAR metadata:
     
       1.  Dependency 'androidx.media:media:1.7.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.
     
           Recommended action: Update this project to use a newer compileSdk
           of at least 34, for example 34.
     
           Note that updating a library or application's compileSdk (which
           allows newer APIs to be used) can be done separately from updating
           targetSdk (which opts the app in to new runtime behavior) and
           minSdk (which determines which devices the app can be installed
           on).

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 8s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction > An issue was found when checking AAR metadata: 1. Dependency 'androidx.media:media:1.7.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. Recommended action: Update this project to use a newer compileSdk of at least 34, for example 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). * Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org. BUILD FAILED in 8s.
info Run CLI with --verbose flag for more details.

Android/Build.gradle

buildscript {
    ext {
        buildToolsVersion = "31.0.0"
        minSdkVersion = 23
        compileSdkVersion = 33
        targetSdkVersion = 33 
        ndkVersion = "25.1.8937393"
        kotlinVersion = "1.8.0"
    }
    repositories {
        google()
        mavenCentral()
        maven { url 'https://maven.google.com' }
        maven { url "https://www.jitpack.io" } 
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.0.1") 
        ......
    }
}
@sikandar-quraishi
Copy link

Have you got any solution?

@sikandar-quraishi
Copy link

I'm also facing a similar issue, after install "react-native-image-crop-picker"

Task :app:processDebugMainManifest FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
161 actionable tasks: 3 executed, 158 up-to-date

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugMainManifest'.

com.android.manifmerger.ManifestMerger2$MergeFailureException: Error parsing C:\Users\Sikandar Quraishi\Desktop\App\New Clone\student-mobile-ui\android\app\src\main\AndroidManifest.xml

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.

  • What went wrong:
    java.lang.StackOverflowError (no error message)

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================

BUILD FAILED in 42s

Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugMainManifest'.

com.android.manifmerger.ManifestMerger2$MergeFailureException: Error parsing C:\Users\Sikandar Quraishi\Desktop\App\New Clone\student-mobile-ui\android\app\src\main\AndroidManifest.xml

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.

  • What went wrong:
    java.lang.StackOverflowError (no error message)

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================

BUILD FAILED in 42s

at makeError (C:\Users\Sikandar Quraishi\Desktop\App\New Clone\student-mobile-ui\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at C:\Users\Sikandar Quraishi\Desktop\App\New Clone\student-mobile-ui\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (C:\Users\Sikandar Quraishi\Desktop\App\New Clone\student-mobile-ui\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:82:7)
at async Command.handleAction (C:\Users\Sikandar Quraishi\Desktop\App\New Clone\student-mobile-ui\node_modules\@react-native-community\cli\build\index.js:108:9)

info Run CLI with --verbose flag for more details.

@lchenfox
Copy link
Author

Have you got any solution?

Not yet. I'm using react-native-image-picker instead. It supports the latest RN version and works well.

@sikandar-quraishi
Copy link

I'm also using the same but there is no crop functionality

@lchenfox
Copy link
Author

@sikandar-quraishi Yes. Unfortunately, this repo does not support Android SDK 34. According to the docs, the Android SDK 33 must be set. I don't know why it doesn't support the latest version like react-native-image-picker does. react-native-image-picker does not need to configure or require this settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants