Error:Cannot read packageName from E:\Lins\ZXing_luolu\ZxingScan-master\zxing-zxing-3.3.0\src\main\AndroidManifest.xml - android-studio

.png is my code short cut
I'm failed to Import third-party source libraries
//following are my build.gradle file
//app module
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.example.meng.zxingscan"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile project(':zxing-zxing-3.3.0')
// compile files('libs/core-3.3.0.jar')
}
//zxing module
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.example.meng.zxingscan"
minSdkVersion 15
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:support-v7:18.+'
}

Related

How to solve undefined refrence error on android libtorch?

i got some issue on android libtorch
when i build my project, it always says to "C/C++: C:/Users/Administrator/AndroidStudioProjects/CardFinder/app/src/main/cpp/native-lib.cpp:26: error: undefined reference to 'torch::cuda::is_available()'"
i've never seen that before on visual studio
here's my android studio setting
'Cmake'
cmake_minimum_required(VERSION 3.18)
project(cardfinder)
set(CMAKE_CXX_STANDARD 14)
set(pathInclude ${CMAKE_SOURCE_DIR}/include)
add_library(native-lib SHARED ${CMAKE_SOURCE_DIR}/native-lib.cpp)
file(GLOB OPENCV_INCLUDE_DIRS "${pathInclude}/opencv")
file(GLOB PYTORCH_INCLUDE_DIRS "${pathInclude}/libtorch")
file(GLOB PYTORCH_API_DIRS "${pathInclude}/libtorch/torch/csrc/api/include")
file(GLOB SOURCE_INCLUDE_DIRS "${pathInclude}/source")
file(GLOB LINK_DIRS "${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}")
include_directories(
${OPENCV_INCLUDE_DIRS}
${PYTORCH_INCLUDE_DIRS}
${PYTORCH_API_DIRS}
${SOURCE_INCLUDE_DIRS})
find_library(
OPENCV_LIBRARY opencv_java4
PATHS ${LINK_DIRS}
NO_CMAKE_FIND_ROOT_PATH)
find_library(
PYTORCH_LIBRARY pytorch_jni
PATHS ${LINK_DIRS}
NO_CMAKE_FIND_ROOT_PATH)
find_library(
FBJNI_LIBRARY fbjni
PATHS ${LINK_DIRS}
NO_CMAKE_FIND_ROOT_PATH)
find_library(log-lib log)
target_link_libraries(
native-lib
${OPENCV_LIBRARY}
${FBJNI_LIBRARY}
${PYTORCH_LIBRARY}
${log-lib}
)
'build.gradle'
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.main.cardfinder"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags '-std=c++14'
}
}
ndkVersion "21.1.6352462"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
externalNativeBuild {
cmake {
path file('src/main/cpp/CMakeLists.txt')
version '3.18.1'
}
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
def cameraxVersion = "1.1.0-alpha05"
implementation "androidx.camera:camera-core:${cameraxVersion}"
implementation "androidx.camera:camera-camera2:${cameraxVersion}"
implementation "androidx.camera:camera-lifecycle:${cameraxVersion}"
// CameraX View class
implementation 'androidx.camera:camera-view:1.0.0-alpha25'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
'my current project'

Unresolved reference everything when i create new jetpack compose project

i found some broke problem here, this is new project with default sample code I haven't do anything with the code then my android studio looks like in the image
I've try a lot of things including uninstalling android studio and re-installing this android studio, but I still found the same problem
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 31
defaultConfig {
applicationId "id.rizki.nidelist"
minSdk 23
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
useIR = true
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion '1.5.21'
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
implementation 'androidx.activity:activity-compose:1.4.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
}
You're not using the correct dependency versions. Most importantly, you are not using the correct version of Kotlin or Java:
In your project grade file use this:
buildscript {
ext {
compose_version = '1.1.0-beta01'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31'
}
}
In your app's gradle file:
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.5.10'
}
apply from: 'codeinc.gradle'
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 21
targetSdkVersion 31
versionName "1.0"
//def yourVersionCode = getIncrementedVersionCode()
versionCode 1
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
useIR = true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion '1.5.31'
}
}
dependencies {
def lifecycle_version = '2.4.0'
def activity_version = '1.4.0'
def retrofit_version = "2.9.0"
def paging_version = '3.1.0-beta01'
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0-rc01'
implementation 'com.google.android.material:material:1.5.0-alpha05'
implementation "androidx.activity:activity-ktx:$activity_version"
implementation "androidx.activity:activity-compose:$activity_version"
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.material:material-icons-extended:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
implementation "androidx.compose.foundation:foundation:$compose_version"
implementation "androidx.constraintlayout:constraintlayout-compose:1.0.0-rc01"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0'
}

Cannot resolve R in Android Studio

I tried to clean,rebuild,sync gradle files...
This is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.user.myapplication"
minSdkVersion 14
targetSdkVersion 21
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:26.0.0-alpha1' }
This also gives error
add above your dependencies
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:23.1.0'
}
and also you need to add these dependencies.
androidTestCompile 'com.android.support:support-annotations:23.1.0'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2.1'
and you are done.

A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr in tid (FinalizerDaemon)

getting this error on switching between two activities containing images and api calls to server and have used glide to load the images. Can any one give suggestions to solve the issue. Has anybody faced such issues ?
Thanks in advance.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
signingConfigs {
config {
keyAlias 'example'
keyPassword 'android'
storeFile file('/home/key/android.jks')
storePassword 'android'
}
}
compileSdkVersion 24
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.example.android"
minSdkVersion 15
targetSdkVersion 24
versionCode 26
versionName "2.16"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
debuggable false
buildConfigField "boolean", "USE_CRASHLYTICS", "true"
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
buildConfigField "boolean", "USE_CRASHLYTICS", "true"
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
staging {
minifyEnabled false
buildConfigField "boolean", "USE_CRASHLYTICS", "true"
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url 'https://maven.google.com'
}
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':library')
// rest api
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.google.android.gms:play-services-maps:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'pub.devrel:easypermissions:0.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true;
}
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.google.android.gms:play-services-places:10.0.1'
compile 'com.stripe:stripe-android:2.0.0'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support.constraint:constraint-layout-solver:1.0.2'
}
apply plugin: 'com.google.gms.google-services'

Error:Execution failed for task ':app:transformClassesWithDexForOfficialRelease'. > Cannot invoke method getMainManifest() on null object

This occurs when I run it on Release channel of Android Studio.
part of my gradle here:
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.inst.instcallcar"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.00"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
productFlavors {
official {
ndk {
abiFilter "armeabi"
}
}
}
buildTypes {
debug {
signingConfig signingConfigs.sign
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.sign
}
}
}
I tested it using gradle version 1.14.1, 3.1 and 3.2, but it doesn't work.
It is result from this issue: ThinRPlugin#2
I delete ThinRPlugin for that issue has not resolved.
It's ok now.

Resources