Gradle cannot find theme - android

I am trying to simply build a second module in my Android project. I have refered to another module, because there are some Activities and classes I want to reuse. This is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "nl.minerall.sapphire.browser"
minSdkVersion 19
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
}
lintOptions {
disable "MissingTranslation"
checkReleaseBuilds false
}
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile project(path: ':sapphirelib')
compile project(path: ':app')
}
The build.gradle of sapphirelib is:
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile files('libs/simple-xml-2.7.1.jar')
compile project(path: ':Zebra_SDK_DS3678')
}
And of app:
apply plugin: 'com.android.application'
android {
signingConfigs {
demo {
keyAlias 'FlexDemo'
keyPassword '******'
storeFile file('/path/to/file.jks')
storePassword '******'
v2SigningEnabled false
}
full {
keyAlias 'PocketFull'
keyPassword '****'
storeFile file('/path/to/file.jks')
storePassword '*****'
v2SigningEnabled false
}
}
compileSdkVersion 19
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "nl.minerall.sapphire.pocket"
minSdkVersion 19
targetSdkVersion 19
}
productFlavors {
full {
applicationId "nl.minerall.sapphire.pocket.full"
signingConfig signingConfigs.full
resValue "string", "app_name", "Sapphire Pocket"
versionCode 13
versionName "Flex 2.0.25"
}
demo {
applicationId "nl.minerall.sapphire.pocket.demo"
signingConfig signingConfigs.demo
resValue "string", "app_name", "Pocket Demo"
versionCode 12
versionName "Flex 1.13 DEMO"
}
ipsdemo {
applicationId "nl.minerall.sapphire.pocket.ipsdemo"
signingConfig signingConfigs.demo
resValue "string", "app_name", "Pocket IPS Demo"
versionCode 12
versionName "Flex 1.13 IPS DEMO"
}
sourceSets.ipsdemo.root = "src/demo"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
}
lintOptions {
disable "MissingTranslation"
checkReleaseBuilds false
}
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile project(path: ':sapphirelib')
}
When I build, I get the error
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.NoActionBar'.
and I am thrown into a values-v21.xml file that is apparently auto-generated. The styles.xml I am using is:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
</resources>
It completely beats me where the android:Theme.Material.Light.NoActionBar comes from ...

Related

Google Play: Bundle was not signed

I'm creating app in Kotlin and I paid Google developer account. But there is some problem with upload .aab file: The Android App Bundle was not signed. I readed all topics at Stackoverflow about it and tried all solutions. Not works for me.
signingConfig signingConfigs.release in build.gradle ends with this error: Could not get unknown property 'release' for SigningConfig. It works only when I set signingConfig. I'm using also this: minifyEnabled false and debuggable = false. So what another I must to try? There exists some new solution for year 2021?!
My build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId '...'
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.00"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders["hostName"] = "..."
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig
debuggable = false
}
applicationVariants.all{
variant ->
variant.outputs.each{
output->
def name = "...apk"
output.outputFileName = name
}
}
}
buildFeatures{
dataBinding = true
viewBinding = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'com.github.amitshekhariitbhu.Fast-Android-Networking:android-networking:v1.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}
I had the same issue when I set "debuggable true" for release build type variant,
pls ensure "debuggable false" is set for release type.
buildTypes {
release {
minifyEnabled true
debuggable false
}
Step by step how to create signed aab file:
In the next window select Android App Bundle (aab)
Now you have to create your own signing key. If you want upload any update in the future, you must sign it with this signing key you created here.
Also every update you need to increment version in build.gradle(app).
Edit 1:
Change: signingConfig to: signingConfig signingConfigs.release and add this:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
The full code:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId '...'
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.00"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders["hostName"] = "..."
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
debuggable = false
}
applicationVariants.all{
variant ->
variant.outputs.each{
output->
def name = "...apk"
output.outputFileName = name
}
}
}
buildFeatures{
dataBinding = true
viewBinding = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'com.github.amitshekhariitbhu.Fast-Android-Networking:android-networking:v1.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}
Edit 2:
I just uploaded the project aab to Google Play with this build.gradle(app):
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 31
defaultConfig {
applicationId "pfhb.damian.uploadtest"
minSdk 28
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
You have to create signing config release, Hope this will work. Let me know if you want to know how to create this block will be more happy to help you.
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'com.google.gms.google-services'
}
//repositories { maven { url 'https://maven.cashfree.com/release' } }
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.xyz.medicine"
minSdkVersion 27
targetSdkVersion 30
versionCode 4
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
// Please check if you have this block or not
signingConfigs {
release {
storeFile file('../secrets/keystore.jks')
storePassword 'DUMMYPASSWORD'
keyAlias 'DUMMYALIAS'
keyPassword 'DUMMYPASSWORD'
}
}
buildTypes {
release {
resValue "string", "BASE_URL", "https://obhaiyya.com/proMaid/"
shrinkResources true
minifyEnabled true
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
shrinkResources false
minifyEnabled false
debuggable true
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
buildFeatures {
dataBinding true
}
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.firebase:firebase-messaging-ktx:22.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "com.airbnb.android:lottie:3.7.1"
}

Unable to build : How to add Android Build Config for new Module

Now i am converting my android code to modularized architectural approach. Facing issues when trying add a dependency on "app" module from "chat" module.
I have the following build config for the "app" module.
android {
lintOptions {
checkReleaseBuilds false
abortOnError false
}
signingConfigs {
companydevconfig {
keyAlias 'company'
keyPassword '123456'
storeFile file('../app/jksFils/company_dev.jks')
storePassword '123456'
}
companyqaconfig {
keyAlias 'company'
keyPassword '123456'
storeFile file('../app/jksFils/company_qa.jks')
storePassword '123456'
}
companyprodconfig {
keyAlias 'company'
keyPassword '123456'
storeFile file('../app/jksFils/release.keystore')
storePassword '123456'
}
}
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.company.employee.dev"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.13"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
aaptOptions {
cruncherEnabled = false
}
testOptions {
unitTests.returnDefaultValues = true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled true
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
dataBinding {
enabled = true
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/rxjava.properties'
}
flavorDimensions "company"
productFlavors {
dev {
dimension "company"
applicationId "com.company.employee.dev"
versionCode 277
versionName "2.0.0.16"
signingConfig signingConfigs.companydevconfig
buildConfigField 'String', 'BASEURL', '"https://dev.company.com"'
}
qa {
dimension "company"
applicationId "com.company.employee.qa"
versionCode 225
versionName "2.0.2.2"
signingConfig signingConfigs.companyqaconfig
buildConfigField 'String', 'BASEURL', '"https://qa.company.com"'
}
prod {
dimension "company"
applicationId "com.company.employee.prod"
versionCode 38
versionName "1.5.20"
signingConfig signingConfigs.companyprodconfig
buildConfigField 'String', 'BASEURL', '"https://cloud.company.com"'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
unitTests.returnDefaultValues = true
unitTests.all {
setIgnoreFailures(true)
jacoco {
includeNoLocationClasses = true
}
}
}
}
Now i have added a new module "chat". And it has following code in build config.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.company.employee.chat"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
dataBinding {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation project(':app')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
When i try to build i get following Error.
ERROR: Unable to resolve dependency for ':chat#debug/compileClasspath': Could not
resolve project :app.
Show Details
Affected Modules: chat
ERROR: Unable to resolve dependency for ':chat#debugAndroidTest/compileClasspath': Could not
resolve project :app.
Show Details
Affected Modules: chat
ERROR: Unable to resolve dependency for ':chat#debugUnitTest/compileClasspath': Could not
resolve project :app.
Show Details
Affected Modules: chat
ERROR: Unable to resolve dependency for ':chat#release/compileClasspath': Could not resolve
project :app.
Show Details
Affected Modules: chat
ERROR: Unable to resolve dependency for ':chat#releaseUnitTest/compileClasspath': Could not
resolve project :app.
Show Details
Affected Modules: chat
Here are some things to consider
There are differences between App Module and Library Module.
Library Module is complied to .aar/file. However, App Module is Compiled to APK.
This means that you can not import App Module as dependency to Library Module. Therefore, Remove This line from Library Module:
implementation project(':app')
Make sure the library is listed at the top of your settings.gradle.
Open settings.gradle of the App Module and make sure there is your library listed
include ':app', ':chat'
import the Library Module to your App Module Build Gradle
import your Library Module as dependency
dependencies {
implementation project(':chat')
}
Most Importantly Have a look at :Create an Android library

Very few supported devices of my Flutter app on PlayConsole

Its been a very fun adventure with Flutter so far and my app just got published in PlayStore but I have 2 problems
Its not visible on most devices
The supported devices is VERY FEW (25 only)
How do I increase the supported versions of Androids? Like from Jellybean to latest?
Its an ALPHA RELEASE
below is the image for reference
my APP-LEVEL build.gradle
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.hivemanila.syncshop_webview"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}

Gradle buildTypes incompatible types

I am new to Gradle build tool. I want to create constant OPEN_WEATHER_MAP_API_KEY in android app but I am getting following error
build.gradle
`apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.android.sunshine.app"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildTypes.all { variant ->
variant.buildConfigField "String", "OPEN_WEATHER_MAP_API_KEY", "1"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}`
I tried multiple things but can not able to resolve it.
Replace:
variant.buildConfigField "String", "OPEN_WEATHER_MAP_API_KEY", "1"
with:
variant.buildConfigField "String", "OPEN_WEATHER_MAP_API_KEY", '"1"'
The String needs to be quoted. If the field was an int, you could have left it unquoted.

gradle signingconfigs not found

In my application I want create debug and release build types
Here is my gradle code
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.pmbo.android.pmb"
minSdkVersion 15
targetSdkVersion 21
versionCode 10001
versionName "1.0"
}
signingConfigs {
myConfigs{
storeFile file("ncv.jks");
storePassword("qwerty");
keyAlias("MyNewApp");
keyPassword("qwerty");
}
}
buildTypes {
release {
minifyEnabled false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig singningConfigs.myConfigs
}
debug {
debuggable true
applicationIdSuffix ".debug"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.google.code.gson:gson:2.3.1'
}
Everytime I try to build gradle I have this error
Error:(30, 0) Could not find property 'singningConfigs' on BuildType_Decorated{name=release, debuggable=false, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, applicationIdSuffix=null, versionNameSuffix=null, minifyEnabled=false, zipAlignEnabled=true, signingConfig=null, embedMicroApp=true, mBuildConfigFields={}, mResValues={}, mProguardFiles=[/Users/pmb/opt/sdk/tools/proguard/proguard-android.txt, /Users/pmb/Documents/MyProjects/PMBO/app/proguard-rules.pro], mConsumerProguardFiles=[], mManifestPlaceholders={}}.
I don't what I did wrong but looked everywhere and couldn't figure out what's the problem here.
My .jks file in my app module as shown in that picture.
Could anyone just tell me what I did wrong?
Error:(30, 0) Could not find property 'singningConfigs' on
Note that the property in the error message is singningConfigs. The real property is signingConfigs. Change:
signingConfig singningConfigs.myConfigs
to:
signingConfig signingConfigs.myConfigs
If you are using gradle experimental 0.7, you can use the following way to create signature:
apply plugin: "com.android.model.application"
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
buildTypes {
release {
signingConfig = $("android.signingConfigs.myConfig")
}
}
}
android.signingConfigs {
create("myConfig") {
storeFile "/path/to/debug.keystore"
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
storeType "jks"
}
}
}
Hope this help those who uses gradle experimental versions.
try to change
signingConfig singningConfigs.myConfigs
to
signingConfig signingConfigs.release

Categories

Resources