Giter Site home page Giter Site logo

commit451 / nativestackblur Goto Github PK

View Code? Open in Web Editor NEW
246.0 11.0 41.0 258 KB

Android StackBlur with gradle support (only for the native method) https://github.com/kikoso/android-stackblur

License: Apache License 2.0

Java 67.58% Kotlin 32.42%
stackblur android blur

nativestackblur's Introduction

NativeStackBlur

Android StackBlur with gradle support (only for the native method) https://github.com/kikoso/android-stackblur

As you may see, kikoso has not yet provided a way to add StackBlur as a gradle dependency easily. This library is an attempt to make the NativeBlurProcess availible through gradle without the need to import any modules or do any other configuration.

Gradle Dependency

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

Then, add the library to your project build.gradle

dependencies {
    implementation("com.github.Commit451:NativeStackBlur:latest.version.here")
}

This library is provided as a "fat" aar with native binaries for all available architectures. To reduce your APK size, use the ABI filtering/splitting techniques in the Android plugin: http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits

Usage

Usage is similar to StackBlur, but also more streamlined:

Bitmap bm = NativeStackBlur.process(source, blurRadius);

Compiling

If you want to compile the original StackBlur lib for various reasons, such as adding more architecture support, simply pull down the original StackBlur repo, navigate to the StackBlur project folder (with the res and src folders). Delete the x86 and other folders containing .so files. Also, remove the <uses-sdk block from the manifest. You will probably also get errors relating to LOCAL_SRC_FILES pointing to a missing file. Since we do not support Renderscript, just open up the Android.mk file and remove the ifneq block. Now, run ndk-build. This should output all the .so files you need within the /libs folder (ignoring the renderscript-v8.jar). This process works with commit cf19121553f50f346c48eabc7ebf04d27b074f17 of android-stackblur

License

Copyright 2022 Commit 451

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

nativestackblur's People

Contributors

jagruti178 avatar jawnnypoo avatar nikunjparadva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nativestackblur's Issues

couldn't find "libblur.so"

Hi @Jawnnypoo

When i open activity which used this library, i get below error.

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.pip.cameraeffect-1/base.apk"],nativeLibraryDirectories=[/data/app/com.pip.cameraeffect-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libblur.so" at java.lang.Runtime.loadLibrary(Runtime.java:366) at java.lang.System.loadLibrary(System.java:989) at com.enrique.stackblur.NativeBlurProcess.<clinit>(NativeBlurProcess.java:20) at com.commit451.nativestackblur.NativeStackBlur.process(NativeStackBlur.java:20) at com.waycreon.pip.SelectedImageActivity.makeMaskImage(SelectedImageActivity.java:193) at com.waycreon.pip.SelectedImageActivity.onCreate(SelectedImageActivity.java:163) at android.app.Activity.performCreate(Activity.java:6005) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2446) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2555) at android.app.ActivityThread.access$800(ActivityThread.java:176) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1437) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5576) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:956) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:751)

support for Nexus 9

When I try to run my app on Nexus 9 with NativeStackBlur dependency, I get the following exception:

UNCAUGHT EXCEPTION (main). Force logging out.:
java.lang.Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/BLA.dev-2/base.apk"],nativeLibraryDirectories=[/data/app/BLA.dev-2/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "library.so"
...
Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/BLA.dev-2/base.apk"],nativeLibraryDirectories=[/data/app/BLA.dev-2/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "library.so"
...

The app does work on other (non 64-bit) devices.

Build failing - can't find NativeStackBlur-1.0.5.aar

Hi,

I've been happily using NativeStackBlur-1.0.5.aar in a project for a quite a few years now (Thanks!)

I've just gone to clean build the project today and am getting the following

Could not find NativeStackBlur-1.0.5.aar (com.github.Commit451:NativeStackBlur:1.0.5).
Searched in the following locations:
https://jitpack.io/com/github/Commit451/NativeStackBlur/1.0.5/NativeStackBlur-1.0.5.aar

That link gives an error:

Build failed. See the log at jitpack.io

Any ideas?

java.lang.UnsatisfiedLinkError: dlopen failed: library "libblur.so" not found

Hi!
My Error:
java.lang.UnsatisfiedLinkError: dlopen failed: library "libblur.so" not found

java.lang.UnsatisfiedLinkError: dlopen failed: library "libblur.so" not found at java.lang.Runtime.loadLibrary0(Runtime.java:1087) at java.lang.Runtime.loadLibrary0(Runtime.java:1008) at java.lang.System.loadLibrary(System.java:1664) at com.enrique.stackblur.NativeBlurProcess.<clinit>(NativeBlurProcess.java:20) at com.commit451.nativestackblur.NativeStackBlur.process(NativeStackBlur.java:20) at softjam.waycreon.pip.SelectedImageActivity.makeMaskImage(SelectedImageActivity.java:455) at softjam.waycreon.pip.SelectedImageActivity.onCreate(SelectedImageActivity.java:398) at android.app.Activity.performCreate(Activity.java:8207) at android.app.Activity.performCreate(Activity.java:8191) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3800) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4003) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2317) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:246) at android.app.ActivityThread.main(ActivityThread.java:8595) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

My build.gradle

 compileSdkVersion 30
    buildToolsVersion '30.0.3'

    defaultConfig {
        applicationId "XXXXXXXXXXXXXXXXXXXX"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode 19
        versionName "1.2"
        multiDexEnabled true
    }

When I start using 1.0.2 , its showing error.

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/commit451/nativestackblur/BuildConfig;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)

NoClassDefFoundError (ClassNotFoundException)

Hi ! Im trying to use it and Im getting that the class cant be found ! D:
Any idea why that could happen ?

Crash is:

 --------- beginning of crash
04-14 22:31:48.091 3990-3990/com.example.santiago.kotlintests E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                Process: com.example.santiago.kotlintests, PID: 3990
                                                                                java.lang.NoClassDefFoundError: Failed resolution of: Lcom/commit451/nativestackblur/NativeStackBlur;
                                                                                    at com.example.santiago.kotlintests.queue_list.recycler.view.TaskView$setBlur$1.run(TaskView.kt:52)
                                                                                    at android.os.Handler.handleCallback(Handler.java:739)
                                                                                    at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                    at android.os.Looper.loop(Looper.java:135)
                                                                                    at android.app.ActivityThread.main(ActivityThread.java:5343)
                                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                                    at java.lang.reflect.Method.invoke(Method.java:372)
                                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
                                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
                                                                                 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.commit451.nativestackblur.NativeStackBlur" on path: DexPathList[[dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-support-annotations-23.3.0_7cf40520635b2ad99fd3fefb5d3477d8777c72a0-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-kotlin-stdlib-1.0.1-2_6a91ce7f088f9cd8f3861b88d402d1856d279b4a-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-kotlin-runtime-1.0.1-2_9a342581d884ac88eb3304de2a0d4319d584bb44-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-internal_impl-23.3.0_389440997ca5e5676aa3ebde4da5aea948ae4b17-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-com.fivehundredpx-blurringview-1.0.0_d998bad930c4586a99fc35c0672ec39347ae5379-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-com.android.support-support-vector-drawable-23.3.0_00c135594037684ea1b2d47b0a65b54a048ea327-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-com.android.support-support-v4-23.3.0_9dbe9d53b32e854dd0502ee38cb7a1a171a64561-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-com.android.support-recyclerview-v7-23.3.0_31aa1fd1958b3ab9e6e45f5df4d6728e54a6d758-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-com.android.support-appcompat-v7-23.3.0_0d855a9b0fa2d26daf46e0bbab7b828a586bd873-classes.dex", dex file "/data/data/com.example.santiago.kotlintests/files/instant-run/dex/slice-com.android.support-animated-vector-drawable-23.3.0_9359ec0272ac749dec746e67694706c4b5d9cd02-classes.dex"],nativeLibraryDirectories=[/data/app/com.example.santiago.kotlintests-2/lib/arm, /vendor/lib, /system/lib, /vendor/lib, /system/lib]]
                                                                                    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                                    at com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader.findClass(IncrementalClassLoader.java:90)
                                                                                    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                                                    at java.lang.ClassLoader.loa

Code (Im using kotlin):

    fun setBlur(blur: Boolean) {
        if (blur) {
            post {
                var bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
                draw(Canvas(bitmap));

                blurImage.visibility = VISIBLE

                blurImage.setImageBitmap(NativeStackBlur.process(bitmap, 15));
            }
        } else blurImage.visibility = GONE

        active = !blur
    }

I created a branch for this issue, so feel free to check the entire code if needed, Ive got no idea why I cant find a reference for the class (when I can see perfectly all your lib from my android-studio)
https://github.com/saantiaguilera/android-kotlin-test-stuff/blob/01-sa-blur_issue/app/src/main/java/com/example/santiago/kotlintests/queue_list/recycler/view/TaskView.kt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.