From 6dba77dfcb02d070a8740ad8552d5160ec316b1e Mon Sep 17 00:00:00 2001 From: karol-bisztyga Date: Mon, 1 Mar 2021 18:28:05 +0100 Subject: [PATCH] add errors --- .gitignore | 2 + android/app/CMakeLists.txt | 49 +++++++++++++++++++ android/app/build.gradle | 24 +++++++++ android/app/src/cpp/sample.cpp | 0 .../rnfbjni/generated/BasePackageList.java | 26 ++++++++++ android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 3 +- 7 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 android/app/CMakeLists.txt create mode 100644 android/app/src/cpp/sample.cpp create mode 100644 android/app/src/main/java/com/rnfbjni/generated/BasePackageList.java diff --git a/.gitignore b/.gitignore index 5e244ad..e377e80 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,5 @@ buck-out/ # Expo .expo/* web-build/ + +android/app/.cxx/ \ No newline at end of file diff --git a/android/app/CMakeLists.txt b/android/app/CMakeLists.txt new file mode 100644 index 0000000..b5c4522 --- /dev/null +++ b/android/app/CMakeLists.txt @@ -0,0 +1,49 @@ +# For more information about using CMake with Android Studio, read the +# documentation: https://d.android.com/studio/projects/add-native-code.html + +# Sets the minimum version of CMake required to build the native library. + +cmake_minimum_required(VERSION 3.4.1) + +# Creates and names a library, sets it as either STATIC +# or SHARED, and provides the relative paths to its source code. +# You can define multiple libraries, and CMake builds them for you. +# Gradle automatically packages shared libraries with your APK. + +set(build_DIR ${CMAKE_SOURCE_DIR}/build) +set(PACKAGE_NAME "my_jni_module") + + #THIS RESULTS IN AN ERROR: + #Could not find a package configuration file provided by "fbjni" with any of + #the following names: + # + #fbjniConfig.cmake + #fbjni-config.cmake + # + #Add the installation prefix of "fbjni" to CMAKE_PREFIX_PATH or set + #"fbjni_DIR" to a directory containing one of the above files. If "fbjni" + #provides a separate development package or SDK, be sure it has been + #installed. +#find_package(fbjni REQUIRED CONFIG) + +add_library( # Sets the name of the library. + ${PACKAGE_NAME} + + # Sets the library as a shared library. + SHARED + + # Provides a relative path to your source file(s). + ./src/cpp/sample.cpp + ) + +target_link_libraries(${PACKAGE_NAME} +# fbjni::fbjni + android + log +) + +#target_link_libraries(my_jni_module +# android +# log +# fbjni::fbjni +#) \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 77292ef..f96cafd 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -123,7 +123,24 @@ def jscFlavor = 'org.webkit:android-jsc:+' */ def enableHermes = project.ext.react.get("enableHermes", false); + // using mavenCentral() here gives this error: + //Execution failed for task ':app:javaPreCompileDebug'. + //> You must specify a URL for a Maven repository. +repositories { + maven { + url "https://plugins.gradle.org/m2/" +// mavenCentral() + } +} + android { + // this also causes + // Duplicate class com.facebook.jni.xxx found in modules jetified-fbjni-0.1.0-runtime (com.facebook.fbjni:fbjni:0.1.0) and jetified-fbjni-java-only-0.0.3 (com.facebook.fbjni:fbjni-java-only:0.0.3) + // where xxx are 17 different classes + dependencies { + implementation 'com.facebook.fbjni:fbjni:0.1.0' + } + compileSdkVersion rootProject.ext.compileSdkVersion compileOptions { @@ -167,6 +184,12 @@ android { } } + externalNativeBuild { + cmake { + path "CMakeLists.txt" + } + } + // applicationVariants are e.g. debug, release applicationVariants.all { variant -> variant.outputs.each { output -> @@ -183,6 +206,7 @@ android { } } + dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) //noinspection GradleDynamicVersion diff --git a/android/app/src/cpp/sample.cpp b/android/app/src/cpp/sample.cpp new file mode 100644 index 0000000..e69de29 diff --git a/android/app/src/main/java/com/rnfbjni/generated/BasePackageList.java b/android/app/src/main/java/com/rnfbjni/generated/BasePackageList.java new file mode 100644 index 0000000..ca37f12 --- /dev/null +++ b/android/app/src/main/java/com/rnfbjni/generated/BasePackageList.java @@ -0,0 +1,26 @@ +package com.rnfbjni.generated; + +import java.util.Arrays; +import java.util.List; +import org.unimodules.core.interfaces.Package; + +public class BasePackageList { + public List getPackageList() { + return Arrays.asList( + new expo.modules.application.ApplicationPackage(), + new expo.modules.constants.ConstantsPackage(), + new expo.modules.errorrecovery.ErrorRecoveryPackage(), + new expo.modules.filesystem.FileSystemPackage(), + new expo.modules.font.FontLoaderPackage(), + new expo.modules.imageloader.ImageLoaderPackage(), + new expo.modules.keepawake.KeepAwakePackage(), + new expo.modules.lineargradient.LinearGradientPackage(), + new expo.modules.location.LocationPackage(), + new expo.modules.permissions.PermissionsPackage(), + new expo.modules.securestore.SecureStorePackage(), + new expo.modules.splashscreen.SplashScreenPackage(), + new expo.modules.sqlite.SQLitePackage(), + new expo.modules.updates.UpdatesPackage() + ); + } +} diff --git a/android/build.gradle b/android/build.gradle index 7a08fa8..c47da30 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -12,7 +12,7 @@ buildscript { jcenter() } dependencies { - classpath("com.android.tools.build:gradle:3.5.3") + classpath('com.android.tools.build:gradle:4.1.2') // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 6623300..e8666dc 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Mon Mar 01 17:15:43 CET 2021 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip