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

still works! 11.2024 #19

Open
zoldaten opened this issue Nov 6, 2024 · 0 comments
Open

still works! 11.2024 #19

zoldaten opened this issue Nov 6, 2024 · 0 comments

Comments

@zoldaten
Copy link

zoldaten commented Nov 6, 2024

i have to update:

  • ncnn_paddleocr\app\src\main\jni\CMakeLists.txt:
project(paddleocrncnn)
cmake_minimum_required(VERSION 3.29.3)
set(OpenCV_DIR ${CMAKE_SOURCE_DIR}/opencv-mobile-4.10.0-android/sdk/native/jni)
find_package(OpenCV REQUIRED core imgproc)
set(ncnn_DIR ${CMAKE_SOURCE_DIR}/ncnn-20240820-android/${ANDROID_ABI}/lib/cmake/ncnn)
find_package(ncnn REQUIRED)
add_library(paddleocrncnn SHARED paddleocr_ncnn.cpp common.cpp clipper.cpp)
target_link_libraries(paddleocrncnn ncnn ${OpenCV_LIBS} jnigraphics)
  • cmake 3.29.3 (cmake installed manually and added sto PATH)
    and changed in build.gradle (Module : app):
apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "29.0.2"
    namespace 'com.tencent.paddleocrncnn'

    defaultConfig {
        applicationId "com.tencent.paddleocrncnn"
        archivesBaseName = "$applicationId"

        ndk {
            moduleName "ncnn"
            abiFilters "armeabi-v7a", "arm64-v8a"
        }
        minSdkVersion 24
    }

    externalNativeBuild {
        cmake {
            version "3.29.3"
            path file('src/main/jni/CMakeLists.txt')
        }
    }
    dependencies {
        implementation 'com.android.support:support-v4:24.0.0'
    }
}
  • in build.gradle (ncnn_paddleocr):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.7.2'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}
  • change in gradle-wrapper.properties:
#Sat Nov 02 16:46:39 MSK 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
  • from AndroidManifest.xml remove strings about project, so it will looks like:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <application android:label="@string/app_name" >
        <activity android:name="MainActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="com.tencent.paddleocrncnn.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths" />
        </provider>
    </application>
</manifest>

666

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

1 participant