React native bluetooth escpos printer Failed to generate APK - reactjs

Trying to implement react-native-bluetooth-escpos-printer
i can build the application successfully but cannt generate apk
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesVersion = "15.0.1"
}

I just change buildToolVesion and compileSdkVersion
and my react-native version is
"react": "17.0.2", "react-native": "0.68.2",
Go to the dependency build.gradle folder YOUR_PROJECT/node_modules/react-native-bluetooth-escpos-printer/android/build.gradle
buildscript {
repositories {
jcenter { url "https://jcenter.bintray.com/" }
maven {url "https://repo.spring.io/plugins-release/"}
mavenCentral()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com'
}
}
dependencies {
// classpath 'com.android.tools.build:gradle:3.1.4'
classpath("com.android.tools.build:gradle:7.0.4")
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion = 21
targetSdkVersion = 31
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
sourceSets {
main {
aidl.srcDirs = ['src/main/java']
}
}
}
repositories {
jcenter { url "https://jcenter.bintray.com/" }
maven {url "https://repo.spring.io/plugins-release/"}
mavenCentral()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.facebook.react:react-native:+' // From node_modules
implementation group: 'com.android.support', name: 'support-v4', version: '27.0.0'
implementation "com.google.zxing:core:3.3.0"
}

Related

React native cannot read index.android.delta

I have already tried a lot but could not get it fix. Everything was working good before I added react-native-easy-gridview in my packages.json and then I checked out my changes after that I got this.
Here is my build.gradle
apply plugin: "com.android.application"
import com.android.build.OutputFile
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.pilbara_weed_management_mobile"
minSdkVersion 16
targetSdkVersion 22
versionCode 8
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-mauron85-background-geolocation')
compile project(':react-native-background-task')
compile project(':react-native-keep-awake')
compile project(':react-native-background-timer')
compile project(':react-native-image-resizer')
compile project(':react-native-fcm')
compile 'com.google.firebase:firebase-core:10.0.1' //this decides your firebase SDK version
compile project(':react-native-fetch-blob')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile ("com.facebook.react:react-native:0.47.2") { force = true } // From node_modules
compile project(':react-native-smart-splashscreen')
compile project(':react-native-fs')
compile project(':react-native-file-opener')
compile project(':react-native-camera')
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
Edit android/app/build.gradle
use this
compile ("com.facebook.react:react-native:0.44.0") { force = true }
and write version of app you use instead of 0.44.0 and delete something like this
compile "com.facebook.react:react-native:+"
or this
compile "com.facebook.react:react-native:0.44.0"
It cause this error for the RN 0.60. You can solve this by following,
npm i jetifier
npx jetify
fixed it for me on RN 0.60.

Why does Android Studio believe my App Engine module is an Android app?

I have a project which contains
an Android app module
an App Engine (Cloud Endpoints) module
When I created the project with an older version of Android Studio, it created a reference between the modules, which I removed. Before I did this, I also tried raising the minimum Version in the app module to 21, but Android Studio or LINT somehow still believes my App Engine module was an app and marks code like
list.isEmpty()
new AbstractMap.SimpleEntry<>()
with something like Call required API level 9 (current min is 1): (...).
The project compiles fine, but the errors are underlined in red and show up in LINT.
Neither in the project gradle nor the module gradle I can see anything suspicious. Any idea what the problem could be or where to search and fix this?
For completeness, here are the gradle files:
Projct:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
App Engine Module:
// https://github.com/GoogleCloudPlatform/gradle-appengine-plugin
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.30'
}
}
repositories {
jcenter();
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.30'
compile 'com.google.appengine:appengine-endpoints:1.9.30'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.30'
compile 'com.google.appengine.tools:appengine-gcs-client:0.5'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.googlecode.objectify:objectify:5.1.3'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.retrofit:converter-simplexml:1.9.0'
compile 'io.jsonwebtoken:jjwt:0.6.0'
compile 'org.slf4j:slf4j-parent:1.7.10' // required for JJWT
compile 'org.slf4j:slf4j-nop:1.7.10' // suppress all internal logging in JJWT
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
endpoints {
getClientLibsOnBuild = true
getDiscoveryDocsOnBuild = true
}
}
App Module:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "cc.closeup.android.test"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
}

Javafxports on Android won't load image due to "Improper call to JPEG library in state 200"

When I run the application with IntelliJ the image is visible but when ported to Android (6.0 & 4.4.2) it isn't. The Image object is instantiated with an URL (website).
Logcat
W/linker: /data/app/com.xxxx.xxxx.scan.application.scanner-2/lib/arm/libjavafx_iio.so: is missing DT_SONAME will use basename as a replacement: "libjavafx_iio.so"
W/System.err: java.io.IOException: Improper call to JPEG library in state 200
//##The error below is thrown at the new Image(url) operation
W/System.err: at com.xxxx.xxxx.scan.application.scanner.controllers.ProductController.updateImageView(ProductController.java:117)
Method that loads the image
private synchronized void updateImageView(ProductEntry product) {
if (product.getExtraInfo() != null && product.getExtraInfo().size() > 0) {
ExtraInfo extraInfo = product.getExtraInfo().get(0);
figLabel.setText(extraInfo.getInfo());
image = new Image(extraInfo.getUrl());
imageView.fitHeightProperty().bind(pane.heightProperty());
imageView.fitWidthProperty().bind(pane.widthProperty());
imageView.setPreserveRatio(true);
// imageView.setSmooth(true);
// imageView.setCache(true);
imageView.setImage(image);
}
}
build.gradle
buildscript {
repositories {
jcenter()
maven {
url 'http://xxxx.xxxx.com:8080/artifactory/plugins-release'
}
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.0.8'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:+"
}
}
apply plugin: 'org.javafxports.jfxmobile'
apply plugin: "com.jfrog.artifactory"
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = 'libs-release-local'
maven = true
}
}
resolve {
repository {
repoKey = 'libs-release'
maven = true
}
}
}
repositories {
jcenter()
mavenLocal()
}
mainClassName = 'com.essers.pxl2016.scan.application.scanner.MainApplication'
dependencies {
compile(group: 'com.essers.pxl2016', name: 'scan-server-definition', version: '0.0.1-SNAPSHOT')
compile(group: 'com.xxxx.xxxx', name: 'client', version: '1.0-SNAPSHOT')
compile('com.google.code.gson:gson:2.2.4')
testCompile "junit:junit:4.12"
}
jfxmobile {
javafxportsVersion = '8.60.7'
ios {
forceLinkClasses = ['com.xxxx.xxxx.scan.**.*']
}
android {
applicationPackage = 'com.xxxx.xxxx.scan.application.scanner'
}
}
test {
exclude 'com/xxxx/xxxx/scan/application/scanner/**'
}
src/main/resources/java.custom.properties
# Solves crash when clicking the menu.
monocle.stackSize=128000
Kind regards
The cause of the problem appears to be the file size of the image. The image showed up after reducing the file size.

Gradle: Plugin with id appengine not found

I m working on Mac, with Android Studio.
I m trying to build a Android App with a Google App Engine BackEnd.
I've installed Maven and Gradel and exported the M2_HOME et GRADLE_HOME
Whenever I run any of the Gradle commends I get this :
Error:(21, 0) Gradle: A problem occurred evaluating project
':backend'. Plugin with id 'appengine' not found.
the Build.gradle file :
buildscript {
repositories {
mavenCentral()
}
dependencies {
}
}
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.3'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.googlecode.objectify:objectify:5.0.+'
compile 'com.google.guava:guava:16.0.+'
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
}
From description on plugin github page you need to define plugin JAR file in the classpath of your build script.
So here is how it can be done:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.3'
}
}
....

Gradle, gae, appengine-web.xml and web.xml not found

I have just started with gae plugin. The problem is that when I run gradle gaeRun I get the exception:
com.google.apphosting.utils.config.AppEngineConfigException: Could not locate ../myapp/build/exploded-war/WEB-INF/appengine-web.xml
So far I managed to get round the problem by adding the following in my gradle.build script:
gaeRun.doFirst{
copy {
from('war/WEB-INF/') {
include '**/*'
}
into 'build/exploded-war/WEB-INF/'
}
}
Is that the correct approach? Below is the whole script:
apply plugin: 'gae'
apply plugin: 'eclipse'
apply plugin: 'scala'
task wrapper(type: Wrapper) {
gradleVersion = '1.0'
}
buildscript {
repositories { mavenCentral() }
dependencies {
classpath 'org.gradle.api.plugins:gradle-gae-plugin:0.7.6'
}
}
repositories {
mavenCentral()
}
dependencies {
scalaTools 'org.scala-lang:scala-compiler:2.9.1'
scalaTools 'org.scala-lang:scala-library:2.9.1'
compile 'org.scala-lang:scala-library:2.9.1'
testCompile group: 'junit', name: 'junit', version: '4.8.2'
}
gae {
httpPort = 8085
optimizeWar = true
appcfg {
email = 'email#gmail.com'
passIn = true
logs {
severity = 1
outputFile = file('mylogs.txt')
}
app { id = 'sample-app' }
}
}
gaeRun.doFirst{
copy {
from('war/WEB-INF/') {
include '**/*'
}
into 'build/exploded-war/WEB-INF/'
}
}

Resources