Inject additional attributes into the defaultConfig tag in the Android build.gradle - codenameone

I need to inject:
ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}
to get something like:
android {
[...]
defaultConfig {
applicationId "app.myapp.client"
minSdkVersion 24
targetSdkVersion 29
versionCode 100
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}
}
[...]
I've already tested in Android Studio that this solves the bug:
https://github.com/codenameone/CodenameOne/issues/3377
The reason is explained here:
https://medium.com/mobiwise-blog/unsatisfiedlinkerror-problem-on-some-android-devices-b77f2f83837d
but I didn't find a build hint to achieve this automatically. Which one can I use?

You can use the build hint:
android.xgradle_default_config=ndk { abiFilters "armeabi-v7a", "x86", "armeabi", "mips"; }

Related

You may need an appropriate loader to handle this file type - React

Hello I am doing blockchain with React but when I import Web 3 using
import Web3 from 'web3'
it give me this error:
./node_modules/web3-eth-accounts/lib/index.js
Module parse failed: Unexpected token (225:12)
You may need an appropriate loader to handle this file type.
| }
| return signed({
| ...tx,
| chainId: args[0],
I am using node 14.17.1 and I created this using
create-react-app my-app --scripts-version 1.1.5
and I installed web3 using
npm install web3
This is the tsconfig.json file and this file showing errors as well
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib",
"esModuleInterop": true
},
"include": [
"./src"
]
}
and index.js code where the error is referring
return signed({
...tx,
chainId: args[0],
nonce: args[1],
networkId: args[2],
...args[3] // Will either be gasPrice or maxFeePerGas and maxPriorityFeePerGas
});
Your project's created with --scripts-version 1.1.5 which mean its babel can not parse ..., consider to use higher scripts-version. For me, I upgraded from 1.1.4 to 3.2.0

WebPack React - Support for the experimental syntax 'jsx' isn't currently enabled

I've checked every other question and none seem to provide an answer that work for me.
Getting this error when attempting to compile:
27 |
28 | return (
> 29 | <G x={logoPosition} y={logoPosition}>
| ^
30 | <Defs>
31 | <ClipPath id='clip-logo-background'>
32 | <Rect
Add #babel/preset-react (https://git.io/JfeDR) to the 'presets' section of your Babel config to enable transformation.
If you want to leave it as-is, add #babel/plugin-syntax-jsx (https://git.io/vb4yA) to the 'plugins' section to enable parsing.
This is the code that is causing it:
import * as React from "react";
import WalletConnectProvider from "#walletconnect/react-native-dapp";
import AsyncStorage from "#react-native-async-storage/async-storage";
export default function WalletConnector() {
return (
<WalletConnectProvider
bridge="https://bridge.walletconnect.org"
clientMeta={{
description: "Connect with WalletConnect",
url: "https://walletconnect.org",
icons: ["https://walletconnect.org/walletconnect-logo.png"],
name: "WalletConnect",
}}
redirectUrl={window.location.origin}
storageOptions={{
asyncStorage: AsyncStorage as any,
}}
>
<>{/* awesome app here */}</>
</WalletConnectProvider>
);
}
This is the package causing it: "#walletconnect/react-native-dapp": "^1.4.1"
I've added .babelrc with the following and problem persists.
"presets": ["#babel/preset-env", "#babel/preset-react"]
}
I've also added babel.confis.json which didn't help and added a babel section in my package.json with the proper plugins/presets and still no change.
For bare CLI project update below files.
Reference: https://github.com/WalletConnect/walletconnect-monorepo/issues/753
Update metro-config.js
module.exports = {
resolver: {
extraNodeModules: require("node-libs-react-native")
},
. . .
};
Add following statement in index.js
require("node-libs-react-native/globals.js");

React native bluetooth escpos printer Failed to generate APK

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"
}

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'
}

Resources