After an intensive search on the internet, I couldn't find any answer to my problem. After I upgraded android studio from beta to rc1, the gradle build script stopped working with the following error:
Error:String index out of range: -1
My build script is as follows:
apply plugin: 'com.android.application'
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
defaultConfig {
applicationId 'myappidhere'
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName '1.0'
}
lintOptions {
abortOnError false
}
android {
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java', 'src/main/java-gen']
res.srcDirs = ['src/main/res']
}
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:support-v4:21.0.2'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.jakewharton:butterknife:6.0.0'
compile 'com.jakewharton.timber:timber:2.5.0'
compile 'de.greenrobot:greendao:1.3.7'
compile 'com.rengwuxian.materialedittext:library:1.5.0'
//local libs
compile(name: 'utilsaaa1', ext: 'aar')
compile(name: 'pixlui_1_0_5_fork', ext: 'aar')
compile project(':Secure_preferences_lib')
}
After reading the gradle log error, the problematic lines are the following:
compile(name: 'utilsaaa1', ext: 'aar')
compile(name: 'pixlui_1_0_5_fork', ext: 'aar')
Both files are inside folder libs.
I have no idea how to fix this so any help would be appreciated.
EDIT1: idea.log
Caused by: org.gradle.api.IllegalDependencyNotation: Supplied String module notation 'utilsaaa1' is invalid. Example notations: 'org.gradle:gradle-core:2.2', 'org.mockito:mockito-core:1.9.5:javadoc'.
Change:
compile(name: 'utilsaaa1', ext: 'aar')
To:
compile 'myappidhere:utilsaaa1:1.0#aar'
Related
I'm using Angular 14 ang webpack version: ^5.58.1.
Below is the config:
webpack.congif.js
const webpackPlugin = require('#ngtools/webpack').AngularWebpackPlugin;
module.exports = {
mode: 'development',
devtool: "source-map",
entry: {
main: "./js/main.js",
mainDrawer: "./js/divdrawer/main.ts",
polyfills: "./js/divdrawer/polyfills.ts",
entry: "./js/entry.js",
thirdpartylibs: "./js/thirdpartylibs.js"
},
output: {
path: path.join(__dirname, "build/"),
filename: "[name]bundle.js"
},
module: {
rules: [
{
parser: {
system: true,
}
}
test : /\.(tsx|ts)$/,
use: [
{
loader: '#ngtools/webpack',
options: {
configFile: path.resolve('./js/tsconfig.json')
},
},
]
},
},
plugins: [
new webpackPlugin({
tsconfig: './js/tsconfig.json',
}),
new webpack.ContextReplacementPlugin(
/\#angular(\\|\/)core(\\|\/)esm5/,
path.resolve(__dirname, "./js/divdrawer")
)
]
}
While generating the build I'm getting below error:
ERROR in ./js/divdrawer/filterMappingRemover.ts
Module build failed (from ./node_modules/#ngtools/webpack/src/index.js):
Error: Emit attempted before Angular Webpack plugin initialization.
at D:\MyProject\node_modules\#ngtools\webpack\src\ivy\loader.js:81:18
# ./js/entry.js 10:30-97
ERROR in ./js/divdrawer/main.ts
Module build failed (from ./node_modules/#ngtools/webpack/src/index.js):
Error: Emit attempted before Angular Webpack plugin initialization.
at D:\MyProject\node_modules\#ngtools\webpack\src\ivy\loader.js:81:18
at processTicksAndRejections (internal/process/task_queues.js:95:5)
ERROR in ./js/divdrawer/polyfills.ts
Module build failed (from ./node_modules/#ngtools/webpack/src/index.js):
Error: Emit attempted before Angular Webpack plugin initialization.
at D:\MyProject\node_modules\#ngtools\webpack\src\ivy\loader.js:81:18
ERROR in ./js/divdrawer/renderer.ts
Module build failed (from ./node_modules/#ngtools/webpack/src/index.js):
Error: Emit attempted before Angular Webpack plugin initialization.
at D:\MyProject\node_modules\#ngtools\webpack\src\ivy\loader.js:81:18
# ./js/entry.js 9:18-61
All the entries are throwing the errors with above message. As mentioned in webpack config we have multiple entries.
This is detected when I upgraded our project to angular 14.(Angular upgrade Steps: v10 --> v11--> v12--> v13/v14)
How to configure AngularWebpackPlugin correctly? Is there any alternative way?
For me this solution worked:
go to package.json and change your typescript version, If you want to upgrade your angular project to
Angular 15 (npm install typescript#"~4.8.0" --save-dev)
"devDependencies": {
...
"typescript": "~4.8.0"
}
Angular 14 (npm install typescript#"~4.7.0" --save-dev)
"devDependencies": {
...
"typescript": "~4.7.0"
}
Credit to F.R
yes downgrading typescript version to 4.8.2 resolve the issue.
For me, upgrading node version 16.xx to 18.xx (LTS) fixed the issue.
i have a cocos2dx game in android studio and when I'm trying to make it support 64 bit requirement then i got this error "couldn't find "libcocos2dcpp.so" " when i start project on my phone
what I've done to support the 64 bit :
i searched on cocos2dx forum for solution to support 64 bit and i found a solution :
* i've Modified Application.MK file : adding APP_ABI := armeabi armeabi-v7a arm64-v8a
* gradle.properties : adding PROP_APP_ABI=armeabi-v7a:arm64-v8a
* build.gradle : adding ndk.abiFilters 'armeabi-v7a', 'arm64-v8a'
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.xxxxx.kidslearngame-oq27wbETBHeT2MFhWg9cOw==/base.apk", zip file "/data/app/com.xxx.kidslearngame-oq27wbETBHeT2MFhWg9cOw==/split_lib_dependencies_apk.apk", zip file "/data/app/com.xxx.kidslearngame-oq27wbETBHeT2MFhWg9cOw==/split_lib_resources_apk.apk", zip file "/data/app/com.xxxx.kidslearngame-oq27wbETBHeT2MFhWg9cOw==/split_lib_slice_0_apk.apk", zip file "/data/app/com.xxxx.kidslearngame-oq27wbETBHeT2MFhWg9cOw==/split_lib_slice_1_apk.apk", zip file "/data/app/com.xxx.kidslearngame-oq27wbETBHeT2MFhWg9cOw==/split_lib_slice_2_apk.apk", zip file "/data/app/com.xxxx.kidslearngame-oq27wbETBHeT2MFhWg9cOw==/split_lib_slice_3_apk.apk", zip file "/data/app/com.xxx.kidslearngame-oq27wbETBHeT2MFhWg9cOw==/split_lib_slice_4_apk.apk", zip file "/data/app/com.xxx.kidslearngame-oq27wbETBHeT2MFhWg9cOw==/split_lib_slice_5_apk.apk", zip file "/data/app/com.xxx.kidslearngame-oq27wbETBHeT2MFhWg9cOw==/split_lib_slice_6_apk.apk", zip file "/data/app/com.xxx.kidslearngame-oq27wbETBHeT2MFhWg9cOw==/split_lib_slice_7_apk.apk", zip file "/data/app/com.xxx.kidslearngame-oq27wbETBHeT2MFhWg9cOw==/split_lib_slice_8_apk.apk", zip file "/data/app/com.xxxx.kidslearngame-oq27wbETBHeT2MFhWg9cOw==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.xxx.kidslearngame-oq27wbETBHeT2MFhWg9cOw==/lib/arm64, /system/lib64, /system/vendor/lib64]]] couldn't find "libcocos2dcpp.so"
those are the solution that i found but when i run the app on my phone it's crashing and giving me the error above but when i removed ndk.abiFilters 'armeabi-v7a', 'arm64-v8a' from gradle.build it's working good but when i upload it to play store they show me the warning message "your app those not support the 64 bit requirement "
Perhaps you should clear the project and in Android Studio select in the menu File -> Invalidate Caches / Restart
Below I give the settings that work for me:
In Application.mk
APP_ABI := arm64-v8a
In gradle.properties
PROP_APP_ABI=armeabi-v7a:arm64-v8a
In app/build.gradle
android {
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
buildToolsVersion PROP_BUILD_TOOLS_VERSION
def versionMajor = 0
def versionMinor = 9
def versionPatch = 0
def versionBuild = 0
defaultConfig {
applicationId "YOUR APP ID"
minSdkVersion PROP_MIN_SDK_VERSION
targetSdkVersion PROP_TARGET_SDK_VERSION
// versionCode 1
// versionName "1.0"
versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
externalNativeBuild {
if (PROP_BUILD_TYPE == 'ndk-build') {
ndkBuild {
targets 'MyGame'
arguments 'NDK_TOOLCHAIN_VERSION=clang'
arguments '-j' + Runtime.runtime.availableProcessors()
}
}
else if (PROP_BUILD_TYPE == 'cmake') {
cmake {
targets 'MyGame'
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \
"-DUSE_CHIPMUNK=TRUE", "-DUSE_BULLET=TRUE"
cppFlags "-frtti -fexceptions"
// prebuilt root must be defined as a directory which you have right to access or create if you use prebuilt
// set "-DGEN_COCOS_PREBUILT=ON" and "-DUSE_COCOS_PREBUILT=OFF" to generate prebuilt, this way build cocos2d-x libs
// set "-DGEN_COCOS_PREBUILT=OFF" and "-DUSE_COCOS_PREBUILT=ON" to use prebuilt, this way not build cocos2d-x libs
//arguments "-DCOCOS_PREBUILT_ROOT=/Users/laptop/cocos-prebuilt"
//arguments "-DGEN_COCOS_PREBUILT=OFF", "-DUSE_COCOS_PREBUILT=OFF"
}
}
}
ndk {
abiFilters = []
abiFilters.addAll(PROP_APP_ABI.split(':').collect{it as String})
}
}
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
//enable gradle.startParameter.taskNames.contains(":app:assembleRelease")
//enable project.hasProperty('splitApks')
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86, armeabi-v7a, and mips.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "x86", "x86_64", "armeabi-v7a", "arm64-v8a"
// Specifies that we want to also generate a universal APK that includes all ABIs.
universalApk true
}
}
// Map for the version code that gives each ABI a value.
def abiCodes = ['x86':3, 'x86_64':4, 'armeabi-v7a':1, 'arm64-v8a':2]
// APKs for the same app that all have the same version information.
android.applicationVariants.all { variant ->
// Assigns a different version code for each output APK.
variant.outputs.each {
output ->
def abiName = output.getFilter(OutputFile.ABI)
output.versionCodeOverride = abiCodes.get(abiName, 0) * 1000000 + android.defaultConfig.versionCode
}
}
. . . . . . . . .
. . . . . . . . .
I hope this helps.
Working on a fitness tracking app for portfolio using AndroidX dependencies, ran into the following error:
"E/LoadedApk: Unable to instantiate appComponentFactory
java.lang.ClassNotFoundException: Didn't find class "androidx.appcompat.app.ActionBar;" on path: DexPathList..." (Full error pasted below).
My actionbar won't appear, so neither will my menu options. In researching this problem, I see it might be a dependencies issue, so my dependencies in module:app are...
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
// Room components
implementation 'androidx.room:room-runtime:2.0.0'
annotationProcessor 'androidx.room:room-compiler:2.0.0'
androidTestImplementation 'androidx.room:room-testing:2.0.0'
// Lifecycle components
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
}
And in project...
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
roomVersion = '2.1.0-alpha06'
archLifecycleVersion = '2.1.0-alpha04'
}
Thank you in advance! If any other code would be helpful, I'll be happy to provide.
java.lang.ClassNotFoundException: Didn't find class "androidx.appcompat.app.ActionBar;" on path: DexPathList[[zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/base.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_dependencies_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_resources_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_0_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_1_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_2_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_3_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_4_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_5_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_6_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_7_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_8_apk.apk", zip file "/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.LoadedApk.createAppFactory(LoadedApk.java:226)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:731)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
at android.app.LoadedApk.getResources(LoadedApk.java:1032)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5749)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/zachg.gsctrainingandnutritiontracker-CH8ZaSUoVNBUoZhkK4ObiA==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:354)
at dalvik.system.DexFile.<init>(DexFile.java:101)
at dalvik.system.DexFile.<init>(DexFile.java:75)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727)
... 12 more
I have set up a simple C++ program that makes use of the boost filesystem module. To build the program I use Bazel 0.25.0. I am working under Windows 10 x64.
I installed Visual Studio 2019 Community Edtion and set BAZEL_VC to E:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC. I have installed the MSYS2 shell.
Here are my files (can be found also on GitHub):
WORKSPACE
workspace(name = "BoostFilesystemDemo")
load("#bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
# Boost
git_repository(
name = "com_github_nelhage_rules_boost",
commit = "6681419da0163d097d4e09c0756c0d8b785d2aa8",
remote = "https://github.com/nelhage/rules_boost",
shallow_since = "1556401984 -0700"
)
load("#com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")
boost_deps()
main.cpp
#include <iostream>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: tut1 path\n";
return 1;
}
std::cout << argv[1] << " " << file_size(argv[1]) << '\n';
return 0;
}
BUILD
cc_binary(
name = "FilesystemTest",
srcs = ["main.cpp"],
deps = [
"#boost//:filesystem",
],
)
When I try to build I receive the following error message (unfortunately mixed with some German language - Datei kann nicht gefunden werden means file not found)
PS E:\dev\BazelDemos\BoostFilesystemDemo> bazel build //...
INFO: Analyzed target //:FilesystemTest (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: E:/dev/bazeldemos/boostfilesystemdemo/BUILD:1:1: Linking of rule '//:FilesystemTest' failed (Exit 1104)
LINK : fatal error LNK1104: Datei "libboost_filesystem-vc141-mt-x64-1_68.lib" kann nicht ge÷ffnet werden.
Target //:FilesystemTest failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.175s, Critical Path: 0.12s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
Does anyone have some idea to fix this problem (compiling the source using Bazel 0.25.0 or up, Visual Studio 2019 Community Edition, Windows 10 x64, Target should be x64)? Using Ubuntu 18.04 everything went fine.
Switching to another git repository that provides boost is also fine for me.
I want to also to use other parts of the boost library such as boost signals2, boost log, boost algorithm and boost compute.
Modify the BUILD.boost this way:
diff --git a/BUILD.boost b/BUILD.boost
index a3a2195..2cffdda 100644
--- a/BUILD.boost
+++ b/BUILD.boost
## -623,6 +623,14 ## boost_library(
":system",
":type_traits",
],
+ defines = select({
+ ":linux_arm": [],
+ ":linux_x86_64": [],
+ ":osx_x86_64": [],
+ ":windows_x86_64": [
+ "BOOST_ALL_NO_LIB",
+ ],
+ }),
)
boost_library(
## -1491,6 +1499,14 ## boost_library(
":predef",
":utility",
],
+ defines = select({
+ ":linux_arm": [],
+ ":linux_x86_64": [],
+ ":osx_x86_64": [],
+ ":windows_x86_64": [q
+ "BOOST_ALL_NO_LIB",
I cloned the rules_boost repo and applied the above changes - the cloned repository can be used direclty in the WORKSPACE file:
workspace(name = "BoostFilesystemDemo")
load("#bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
# Boost
git_repository(
name = "com_github_nelhage_rules_boost",
commit = "f0d2a15d6dd5f0667cdaa6da9565ccf87b84c468",
remote = "https://github.com/Vertexwahn/rules_boost",
shallow_since = "1557766870 +0200"
)
load("#com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")
boost_deps()
Currently, a pull request is running to merge these changes into the original repository: https://github.com/nelhage/rules_boost/pull/123
Project/
dub.sdl/
source/
examples/
test/
source/
app.d
dub.sdl
Project/dub.sdl
...
subpackage "./examples/test"
...
Project/examples/test/dub.sdl
name "test"
targetType "executeable"
If I try to execute dub run test if get the following error
Failed to parse package description for test in Project/examples/test.
Failed to find a package named 'test'.
The same happens if I try to execute dub run :test.
In the command, you should prefix the subpackage name with the root package name.
dub run rootpackagename:test
It appears you need to specify run (or build or some other command) explicitly).
As of year 2017 with dub version 1.3.0: <rootpackagename> is optional. For example, I was testing jsoniopipe package as following:
# Add dependency which is not found on dub's repo:
git clone https://github.com/schveiguy/iopipe ../iopipe
dub add-local ../iopipe
dub.sdl file:
name "jsoniopipe"
description "JSON parser for iopipe"
authors "Steven Schveighoffer"
copyright "Copyright © 2017, Steven Schveighoffer"
license "boost"
targetType "library"
dependency "iopipe" version="*"
subPackage {
name "formatjson"
targetType "executable"
sourcePaths "examples/formatjson"
dependency "jsoniopipe" version="*"
}
Content of testjson.json
{
"name": "myproject",
"authors": [
"My Name"
],
"description": "My first project",
"copyright": "Copyright © 2017, imadev",
"license": "Boost"
}
Run command:
dub run :formatjson -- ./testjson.json