i´m trying to have two "paths" in my app depending of the Flavor. This is my Gradle file ->
defaultConfig {
applicationId "com.example.modularcineview"
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
flavorDimensions "appType"
productFlavors {
DefaultFlavor {
dimension "appType"
applicationIdSuffix ".client"
//Will be added to package name of the app, making the app unique
//More can be added like
versionCode 1
versionName "1.0"
versionNameSuffix ".client"
}
DemoFlavor {
dimension "appType"
applicationIdSuffix ".rider" //As said above
//More can be added like
versionCode 1
versionName "1.0"
versionNameSuffix ".rider"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
So, i have this two flavours, "DefaultFlavor" and "DemoFlavor" and I created ( taking this documentation as a reference https://developer.android.com/studio/build/build-variants#sourcesets ) the files for the sourceSets.
Now, my issue starts as soons I build a variant type, for instance I choose "DefaultFlavorDebug"...and in the other flavor´s manifest this happens
So I crash, what im doing wrong ?
Related
I have a problem for closing/canceling displayed intercom messenger in android. When I click the close(X) button, it does nothing.
I reliazed that WINDOW_DID_HIDE, WINDOW_DID_SHOW listeners does not work in android.
"react-native": "0.65.1",
"react-native-intercom": "^21.1.1"
versions are used
io.intercom.android:intercom-sdk:10.4.0 used for android
and android/build.gradle buildscript
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 23
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "20.1.5948944"
kotlinVersion = '1.3.72'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.1")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
Any idea what might be the wrong with it ?
Try with the official react-native package #intercom/intercom-react-native
I have upgrade my projet to jetpack compose 1.1.1, together with Kotlin 1.6.10 and 7.1.2 upgrade of datastudio.
From then, Android studio throws an error when trying to use Modifier.align(..).
I checked the release notes of jpc, and can't find any information that align() is depreciated.
Can't understand what is wrong here
without .align, the project is buidling fine, but I can no longer align a button at the botton of the screen :-(
my projet build.gradle
buildscript {
ext {
compose_version = '1.1.1'
nav_version = "2.4.1"
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
my Module build.gradle
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.jerome.jetpackcomposecrashcourse"
minSdk 29
targetSdk 32
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'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.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.3.1'
implementation 'androidx.activity:activity-compose:1.3.1'
testImplementation 'junit:junit:4.13.2'
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"
// navigation
implementation "androidx.navigation:navigation-compose:$nav_version"
}
the composable taht was fine before but now throwing error
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Button
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
#Composable()
fun AddAlbumButton() {
val mainButtonColor = ButtonDefaults.buttonColors(backgroundColor = Color(247, 197, 33))
Button(
colors = mainButtonColor,
modifier = Modifier
.padding(24.dp)
.align(Alignment.BottomCenter) // <----- ERROR HERE
,
onClick = {
/*albums.add(
Album(
R.drawable.booksouls,
"book of souls",
"View details",
Font(R.font.font_book_of_souls, weight = FontWeight.ExtraBold),
fontSize = 16.sp
)
)*/
}
) {
Text(text = "Add one")
}
}
I just tried your code with Jetpack Compose 1.0.1 version and it didn't work there too. You can wrap your button inside Column, Row or Box.
Box(
modifier = Modifier.fillMaxWidth(),
contentAlignment = Alignment.BottomCenter
) {
Button(
modifier = Modifier
.padding(24.dp),
onClick = {
}
) {
Text(text = "Add one")
}
}
I have an Android Studio (3.4.1) cocos2d-x project with multiple modules. My settings.gradle file defines the 3 modules:
include ':libcocos2dx'
project(':libcocos2dx').projectDir = new File(settingsDir, '../cocos2d/cocos/platform/android/libcocos2dx')
include ':ToaTetrisApp'
project(':ToaTetrisApp').projectDir = new File(settingsDir, 'app')
include ':gameCircleSDK'
NOTE: gameCircleSDK does not need its projectDir set because the directory matches the module name inside proj.android
The problem I have is that when I build a release build of the application OR I try to Build->Generate Signed Bundle / APK I get the following error:
>Task :ToaTetrisApp:transformClassesAndResourcesWithR8ForRelease FAILED
AGPBI: {"kind":"error","text":"Program type already present: com.amazon.ags.BuildConfig","sources":[{}],"tool":"D8"}
NOTE: com.amazon.ags.BuildConfig is an auto-generated class for the gameCircleSDK module. The AndroidManifest.xml for gameCircleSDK defines package="com.amazon.ags" and this is the only place that the package is defined.
I also searched my generated files and found only the expected BuildConfig.java files in the release folders: com.toa.tetris (ToaTetrisApp), com.amazon.ags (gameCircleSDK), org.cocos2dx.lib (cocos2d-x)
I have the following build.gradle files:
proj.android:build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
buildDir = "C:/tmp/${rootProject.name}/${project.name}"
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
proj.android:app:build.gradle [ToaTetrisApp]
import org.gradle.internal.os.OperatingSystem
apply plugin: 'com.android.application'
android {
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
defaultConfig {
applicationId "com.toa.tetris"
minSdkVersion PROP_MIN_SDK_VERSION
targetSdkVersion PROP_TARGET_SDK_VERSION
versionCode 21
versionName "4.5.1"
multiDexEnabled true
externalNativeBuild {
if (PROP_BUILD_TYPE == 'ndk-build') {
ndkBuild {
targets 'MyGame'
arguments 'NDK_TOOLCHAIN_VERSION=clang'
//arguments 'V=1'
arguments '-j' + Runtime.runtime.availableProcessors()
def module_paths = [project.file("../../cocos2d").absolutePath,
project.file("../../cocos2d/cocos").absolutePath,
project.file("../../cocos2d/external").absolutePath]
if (OperatingSystem.current().isWindows()) {
module_paths = module_paths.collect {it.replaceAll('\\\\', '/')}
arguments 'NDK_MODULE_PATH=' + module_paths.join(";")
}
else {
arguments 'NDK_MODULE_PATH=' + module_paths.join(':')
}
}
}
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"
cppFlags "-frtti -fexceptions -fsigned-char"
}
}
}
ndk {
abiFilters = []
abiFilters.addAll(PROP_APP_ABI.split(':').collect{it as String})
}
}
sourceSets.main {
java.srcDir "src"
res.srcDir "res"
manifest.srcFile "AndroidManifest.xml"
assets.srcDir "../../Resources"
}
externalNativeBuild {
if (PROP_BUILD_TYPE == 'ndk-build') {
ndkBuild {
path "jni/Android.mk"
}
}
else if (PROP_BUILD_TYPE == 'cmake') {
cmake {
path "../../CMakeLists.txt"
}
}
}
signingConfigs {
release {
<CONTENT REMOVED>
}
debug {
<CONTENT REMOVED>
}
}
buildTypes {
release {
debuggable false
jniDebuggable false
renderscriptDebuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
if (project.hasProperty("RELEASE_STORE_FILE")) {
signingConfig signingConfigs.release
}
externalNativeBuild {
ndkBuild {
arguments 'NDK_DEBUG=0'
}
}
}
debug {
debuggable true
jniDebuggable true
renderscriptDebuggable true
externalNativeBuild {
ndkBuild {
arguments 'NDK_DEBUG=1'
}
}
}
}
}
android.applicationVariants.all { variant ->
// delete previous files first
delete "${buildDir}/intermediates/assets/${variant.dirName}"
variant.mergeAssetsProvider.get().doLast {
copy {
from "${buildDir}/../../../Resources"
into "${buildDir}/intermediates/assets/${variant.dirName}"
exclude "**/*.gz"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(dir: '../gameCircleSDK/libs', include:['*.jar'])
implementation project(':libcocos2dx')
implementation project(':gameCircleSDK')
}
proj.android:gameCircleSDK:build.gradle
apply plugin: 'com.android.library'
android {
signingConfigs {
debug {
<CONTENT REMOVED>
}
}
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
//buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion PROP_MIN_SDK_VERSION
targetSdkVersion PROP_TARGET_SDK_VERSION
}
sourceSets.main {
manifest.srcFile "src/main/AndroidManifest.xml"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
//implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
}
proj.android:..:cocos2d:cocos:platform:android:libcocos2dx:build.gradle
apply plugin: 'com.android.library'
android {
signingConfigs {
debug {
<CONTENT REMOVED>
}
}
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
defaultConfig {
minSdkVersion PROP_MIN_SDK_VERSION
targetSdkVersion PROP_TARGET_SDK_VERSION
versionCode 1
versionName "1.0"
}
sourceSets.main {
aidl.srcDir "../java/src"
java.srcDir "../java/src"
manifest.srcFile "AndroidManifest.xml"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: '../java/libs', include: ['*.jar'])
}
I have been searching and found many recommendations and tried many of them to no avail. Here are some of the things I've tried:
I tried File->Invalidate Caches / Restart: NOTE: I originally had the same problem with my debug build and run and this is the solution that resolved that issue.
I have tried running 'gradlew ToaTetrisApp:dependencies' and I don't see any reference to com.amazon.ags nor any duplicates. I'm not sure I fully understand the output, but it seems for the debug, release and tests the dependencies seem to be as expected
I have, of course, tried to clean and rebuild many times, but to no avail
I have added 'multiDexEnabled true' to my app:build.gradle file. I'm not sure whether this really did anything or whether I added it to the correct file. This didn't seem to resolve the issue
I have tried to add 'afterEvaluate { generateReleaseBuildConfig.enabled = false }', but again, I wasn't sure which build.gradle to add this to so I couldn't get it to work
I'm hoping that someone can provide some explanation of what exactly this error means and how I can track down and resolve this issue myself. This project doesn't use a lot of external dependencies so I would expect that it would be easy to track down what is going on exactly and why this error shows up. If you would like to offer some suggestions then please let me know which gradle file you would like me to add the code to as that is often not mentioned.
I can't solve this problem, please help me! I've got the following error:
Could not find com.android.support:appcompat-v7:28.0.3.
Searched in the following locations:
file:/C:/invincible/extras/m2repository/com/android/support/appcompat-v7/28.0.3/appcompat-v7-28.0.3.pom
file:/C:/invincible/extras/m2repository/com/android/support/appcompat-v7/28.0.3/appcompat-v7-28.0.3.jar
file:/C:/invincible/extras/google/m2repository/com/android/support/appcompat-v7/28.0.3/appcompat-v7-28.0.3.pom
file:/C:/invincible/extras/google/m2repository/com/android/support/appcompat-v7/28.0.3/appcompat-v7-28.0.3.jar
file:/C:/invincible/extras/android/m2repository/com/android/support/appcompat-v7/28.0.3/appcompat-v7-28.0.3.pom
file:/C:/invincible/extras/android/m2repository/com/android/support/appcompat-v7/28.0.3/appcompat-v7-28.0.3.jar
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/appcompat-v7/28.0.3/appcompat-v7-28.0.3.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/appcompat-v7/28.0.3/appcompat-v7-28.0.3.jar
https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/28.0.3/appcompat-v7-28.0.3.pom
https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/28.0.3/appcompat-v7-28.0.3.jar
http://jcenter.bintray.com/com/android/support/appcompat-v7/28.0.3/appcompat-v7-28.0.3.pom
http://jcenter.bintray.com/com/android/support/appcompat-v7/28.0.3/appcompat-v7-28.0.3.jar
Required by:
project :app
Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager
I tried to download, but there shows this:
{
"errors" : [ {
"status" : 404,
"message" : "Could not find resource"
} ]
}
and my build.gradle shows Gradle project sync failed. Basic functionality will not work properly.
my build.gradle code:
***android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
targetSdkVersion 28
buildToolsVersion "28.0.3"
versionCode 1
versionName "1.0.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
customDebugType {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
buildToolsVersion '28.0.3'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
productFlavors {
}
dexOptions {
incremental true
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.3'
implementation "com.android.support:support-core-utils:28.0.3"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.3'
implementation 'com.android.support:exifinterface:28.0.3'
implementation 'com.android.support:support-v4:28.0.3'
implementation 'com.google.firebase:firebase-core:16.0.4'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.android.support:support-media-compat:28.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.4'
implementation 'com.google.firebase:firebase-database:16.0.3'
implementation 'com.google.firebase:firebase-storage:16.0.3'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.google.android.gms:play-services-places:16.0.0'
}
apply plugin: 'com.google.gms.google-services'***
I'm sorry for my English and please help me
You can replace this dependency
implementation 'com.android.support:appcompat-v7:28.0.3'
with this
implementation 'com.android.support:appcompat-v7:28.0.0'
And also remove this line
buildToolsVersion '28.0.3
this is work for me .
You can check latest version of appcompat-v7 there: https://mvnrepository.com/artifact/com.android.support/appcompat-v7?repo=google.
So, you can find just appcompat-v7:28.0.0.
You must change
appcompat-v7:28.0.3 to appcompat-v7:28.0.0. No more else.
I have an Android project that uses gradle with library project as dependency.Dependency project has same package name as project.When I try to build the project but failed.
Here is the folder structure with files in question:
Library AndroidMainifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test"
android:allowBackup="true">
</manifest>
Library build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
enforceUniquePackageName false
defaultConfig {
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
dexOptions {
preDexLibraries false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
Project build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
enforceUniquePackageName false
defaultConfig {
applicationId "com.test"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1"
}
lintOptions {
abortOnError false
}
dexOptions {
preDexLibraries false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':testLib')
}
Error Message :
Error:Class com.test.BuildConfig has already been added to output. Please remove duplicate copies.
1 error; aborting
Error Code:
1
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/test/BuildConfig;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:732)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:83)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
1 error; aborting
I think there is only one way - rename one of packages. I tried to add 'exclude' option to build.gradle, but it was not successful attempt. Meantime, it was not option, because of your app needs both BuildConfig classes.