Compiled MuPDF library integration in android project - pdf-rendering

I have compiled mupdf library but when I integrate it in my existing android project to render the PDF it give me the following error :
java.lang.ExceptionInInitializerError
I have followed the following steps for integration :
Steps are explained here :
http://pastebin.com/YzHUhzE7
When i change the package name in mupdf test project then the native code get modified and the above expiation arises . So if any one knows how to integrate MuPDF compiled in my project .

finally I have integrated compiled mupdf library into my project .
Following steps I have followed :
after importing library into my project run the ndk-build on the jni. It will build the library.
Now the ExpetionInitializationError is solved.
Now the application is running on the device.

You can find the answer in this link http://www.chinabtp.com/android-pdf-viewer-library-or-mupdf-library-tutorials/
Here is the instruction:
Building a MuPDF lib on windows with Cygwin and android-ndk
Download MuPDF 1.3 Source from https://code.google.com/p/mupdf/downloads/list unzip to folder c:/mupdf-1.3-source
Install Cygwin: Download and run Run setup-x86.exe from http://cygwin.com/install.html when installing cygwin, make sure you selected make packages and C++ compilers
Make generate. open cygwin terminal, run
cd /cygdrive/
cd c/mupdf-1.3-source
make generate
Install android-ndk: download android-ndk-r9d-windows-x86.zip and unzip it to
c:/android-ndk-r9d
Build mupdf lib: on windows cmd console:
preparation:
cd c:/mupdf-1.3-source/platform/android
copy local.properties.sample local.properties
edit local.properties, uncomment
#sdk.dir=C:\\Program Files (x86)\\Android\\android-sdk
and change to
sdk.dir=REAL andforid-sdk Folder
build: while still on c:/mupdf-1.3-source/platform/android, run:
/android-ndk-r9d/ndk-build
Upon the completion of the build, a folder named libs will be created under
c:/mupdf-1.3-source/platform/android
Create android apk. Open eclipse, create a new android project from existing code, browse to c:/mupdf-1.3-source/platform/android, now you can create a mupdf apk.

Related

Build configuration error using Android NDK

There is a build configuration error (Gradle sync failed) starting a new simple Android project using IntelliJ IDEA and the installed Android SDK (API 28) to include C++ support.
If I can remember, it worked when first installed, but now any attempt to compile and build the project using the IntelliJ GUI fail. LLDB, CMake and NDK are all installed correctly in the correct folders and the local.properties file references the location of the SDK and NDK.
All attempts to refresh linked C++ projects or clear caches (invalidate caches/restart) make no difference.
CMake_server_log.txt suggests:
CMAKE SERVER: CMake Error: CMake was unable to find a build program
corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You
probably need to select a different build tool.
Build output (edited to remove path):
Cause: executing external native build for cmake CMakeLists.txt
There appears to be a lack of configuration to complete the build or missing PATH or ENVIRONMENT variable. Should I manually try to change this or add some extra code to the build.gradle or CMakeLists.txt? There is the ninja application in the cmake bin directory.
Even importing other NDK sample projects fail (after downloading any required dependencies e.g. Gradle version).
Reinstalling LLDB, CMake and the NDK via SDK Tools do not solve the issue either.
I get the impression that I need to completely uninstall IntelliJ IDEA on Windows and remove any remaining folders/files associated with it, before reinstalling it. That would be a shame as IntelliJ IDEA works for other type of Android projects not requiring native C++ support.

How can I upgrade react-native gradle version

I need help.
I can't upgrade gradle version of my react-native project.
I try a lot of things, downloaded last version of Android Studio & SDK Tools etc.
I changed this file \android\gradle\wrapper\gradle-wrapper.properties, I tried to upgrade using npm install -g react-native-git-upgrade but still I can't upgrade it.
When I react-native eject It's exports
"distributionUrl=https://services.gradle.org/distributions/gradle-2.14.1-all.zip"
Waiting for answers.
In android/build.gradle you have to edit this line
classpath 'com.android.tools.build:gradle:x.y.z'
Change x.y.z with the version you want. Edit it with Android Studio then click Sync now
In {yourProject}\android\gradle\wrapper\gradle-wrapper.properties, update:
distributionUrl=https\://services.gradle.org/distributions/gradle-{your version}.zip
Find your version of gradle with
gradle --version
You may need to install gradle wrapper if you haven't already.
you can go to https://services.gradle.org/distributions/ and check that latest -all.zip version of gradle and update the same in your gradle-wrapper.properties file. When you run your react-native app the next time, your gradle will first get upgraded and then run.
There are two things
Android Gradle Plugin
You can see the version of it in android/build.gradle file and update it using Daniel's answer here
Gradle version
You can see this in android\gradle\wrapper\gradle-wrapper.properties file and update it using the answer mentioned here
To know the difference between them refer following links:
https://developer.android.com/studio/releases/gradle-plugin
difference between android gradle plugin and gradle
Open Android Studio and navigate to File → Project Structure
Then click on the Project option.
then choose the latest version of Gradle. After that click on Ok.
From Gradle's site:
https://gradle.org/install/#with-the-gradle-wrapper
Upgrade with the Gradle Wrapper If your existing Gradle-based build
uses the Gradle Wrapper, you can easily upgrade by running the wrapper
task, specifying the desired Gradle version:
$ ./gradlew wrapper --gradle-version=6.6.1 --distribution-type=bin
Note that it is not necessary for Gradle to be installed to use the
Gradle wrapper. The next invocation of gradlew or gradlew.bat will
download and cache the specified version of Gradle.
$ ./gradlew tasks
Downloading https://services.gradle.org/distributions/gradle-6.6.1-bin.zip ...
Run these commands in your project's android folder
I had opened my project in Terminal and ran open -a /Applications/Android\ Studio.app to open Android Studio but so that it can access node to download my gradle version which it did automatically.
Learned from this original post: React Native on Android: Cannot run program "node": error=2, No such file or directory
For react native
Go to File -> Project Structure -> Change gradle version to 6.1.1 plugin version to 4.0.0
Try different combinations
Use this link - https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle

(Chromium build) How can I generate Ninja project files for the third_party/webrtc/examples?

I'm doing this on windows but I'm not sure it matters. It appears that the command to generate the Ninja project files for the Chromium source tree:
gn gen out\Default
Only builds projects files for some of the code in third_party\webrtc. I need to build project files for third_party\webrtc\examples. I've been trying to make changes to the BUILD.gn files but so far I haven't had any luck in getting gn to make me some project files for the examples.
Is there any switch or other flag I could set to build the examples?
Thank you for any suggestions.
You probably need to checkout webrtc and build run gn gen from there. The chromium build does not necessarily build all of the targets in webrtc.
See the webrtc docs for info on how to build.

use gradle to compile any android project in first time,gradle.zip always download again?

ext:
OS: window8 x64
android studio 2.1.3
gradle plugin 2.1.3
gradle 2.14.1
I have already download gradle-2.14.1.zip when compile project last time, use git clone project from github, modify graldw-plugin version and distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip in graldle-wrapper.properties
In embed Terminal run gradlew build it download gradle again,like this(sorry pic not allow enbed) (redundant file take up more C disk rest space) how to solve?

How to generate 64-bit version of sikuli JAR?

I am working on developing test automation code in selenium, I want to use 'sikuli' inside my code to handle windows and Flash objects in my web application,
I'm using 64-bit JVM, but there is no 64-bit version of Sikuli available, this is resulting in an error while running the code,
"Can't load IA 32-bit .dll on a AMD 64-bit platform"
I could not find a 64-bit sikuli Jar on internet, but I found that Sikuli source code is hosted on GitHub, could someone help me understand if I can use that source code and compile it into a jar of 64 bit version?
I'm not sure if this is possible or not.
If you install Sikuli 1.0.1 you have the option to install 6 packages with it as well. I would recommend installing the first 5. Then you will have all the things you are ever going to use.
If you also work on different sytems other then Windows, the 6th packages is also advisable.
I have installed all 6.
Finally got this working, here is what I did,
Download the sikuli set-up Jar from
"https://launchpad.net/sikuli/sikulix/1.0.1/+download/sikuli-setup.jar"
Save this jar in a folder 'SikuliSetup',now create a sub directory
'Downloads' which will come into picture later.
Run the above Jar, this will generate two files under the above
directory.
Now run the 'runSetup.bat' file generated from above setup. This
will start the setup, now select the 4th and 6th option in the
'sikulisetup' pop-up and click on 'setup Now'.
The above step will fail for most people due to default security
issues.
If the above step fails then you need to download an offline
version of this jar from this URL
"https://launchpadlibrarian.net/156273987/Sukuli-1.0.1-Offline-Setup-Java-option3-option4.zip".
UnZip the above file and copy the '1.0.1-3.jar' file to 'Downloads'
directory created under the 'SikuliSetup' directory previously.
Now run the 'runSetup.bat' file again, this will generate a new
jar file 'sikuli-java' and its dependent libraries under 'lib'
folder.
That's it, now copy this jar 'sikuli-java.jar' to your java build
path in eclipse.
Now Java will use this sikuli libraries without any issues.
Once after you setup the jar file under build path, restart the
system and login again.