I am pretty sure that I have checked all the possible duplicate questions and none solve my problem. I have instant run turned off, I have minfy and shrink set to false. I have cleaned. The keyfile exists and worked perfectly on a previous release of this app. I have tried running the compile with --info but it does not give me any hints as the the problem. The error is:
Execution failed for task ':app:packageRelease'.
Failed to read key myreleasekey from store "C:\Users\Mel\AndroidStudioProjects\tourbuilderkeystore.jks": Cannot recover key
My build gradle is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.myguidedtours.www.tourguide"
minSdkVersion 16
targetSdkVersion 27
versionCode 10
versionName '1.10'
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
// implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-fragment:27.1.1'
implementation 'com.android.support:support-compat:27.1.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-base:15.0.1'
implementation 'com.google.android.gms:play-services-tasks:15.0.1'
implementation 'com.google.android.gms:play-services-basement:15.0.1'
implementation 'com.android.support:mediarouter-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation "com.android.support:exifinterface:27.1.1"
implementation files('libs/PdfViewer.jar')
}
I have been sweating over this for two days - I hope you can help.
Just in case there's someone out there as stupid as me. The prompt for Generate a Signed APK in Android Studio, does not tell you if the passwords you supply are good or bad. I must have miss-keyed one of them, then, because I ticked the remember passwords option, it failed every time I tried to run it. There is no hint that the password may be wrong - usually when you enter a bad password you get immediate feedback.
Related
This is the first time I've used Android Studio and I can't build this app.
Can anyone tell me how to fix this code?
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "org.settingsdeployer"
minSdkVersion 15
targetSdkVersion 21
versionCode 4
versionName "1.2"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
normal {
applicationId "org.settingsdeployer"
versionCode 4
versionName "1.2"
}
french {
applicationId "org.settingsdeployer"
versionCode 5
versionName "1.2_fr"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
I'm getting these errors when it tries to sync:
ERROR: All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html
Affected Modules: org.settingsdeployer
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: org.settingsdeployer
I made the requested changes and it sync'd but now I can't make an apk:
That's great, it sync'd the build without errors but now when I try to generate an apk i get more errors. I have no idea what I'm doing!
UPDATE:
After adding flavorDimensions it sync'd the build without errors but now when I try to generate an apk i get more errors. I have no idea what I'm doing!. Here is the error log:
Executing tasks: [:org.settingsdeployer:assembleNormalRelease]
Task :org.settingsdeployer:preBuild UP-TO-DATE Task :org.settingsdeployer:preNormalReleaseBuild UP-TO-DATE Task :org.settingsdeployer:compileNormalReleaseAidl NO-SOURCE Task :org.settingsdeployer:compileNormalReleaseRenderscript UP-TO-DATE Task :org.settingsdeployer:checkNormalReleaseManifest UP-TO-DATE Task :org.settingsdeployer:generateNormalReleaseBuildConfig UP-TO-DATE Task :org.settingsdeployer:prepareLintJar UP-TO-DATE Task :org.settingsdeployer:generateNormalReleaseSources UP-TO-DATE Task :org.settingsdeployer:javaPreCompileNormalRelease UP-TO-DATE Task :org.settingsdeployer:mainApkListPersistenceNormalRelease Task :org.settingsdeployer:generateNormalReleaseResValues UP-TO-DATE Task :org.settingsdeployer:generateNormalReleaseResources UP-TO-DATE Task :org.settingsdeployer:mergeNormalReleaseResources FAILED
FAILURE: Build failed with an exception.
What went wrong: Could not resolve all files for configuration ':org.settingsdeployer:_internal_aapt2_binary'.
Could not find com.android.tools.build:aapt2:3.3.1-5013011. Searched in the following locations:
file:/C:/Users/Stuart/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
file:/C:/Users/Stuart/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
file:/C:/Users/Stuart/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
file:/C:/Users/Stuart/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
file:/C:/Users/Stuart/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
file:/C:/Users/Stuart/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
https://jcenter.bintray.com/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
https://jcenter.bintray.com/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar Required by: project :org.settingsdeployer
Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights.
I'm getting these errors when it tries to sync: ERROR: All flavors
must now belong to a named flavor dimension. Learn more at
https://d.android.com/r/tools/flavorDimensions-missing-error-message.html
Affected Modules: org.settingsdeployer
The flavor dimension problem is happened because you haven't add the flavorDimensions to your build.gradle. There must be at least one flavorDimensions. Something like this:
android {
...
defaultConfig {...}
buildTypes {
debug{...}
release{...}
}
// you need to specifies one flavor dimension.
flavorDimensions "version"
productFlavors {
normal {
// This property is optional if you are using only one dimension.
dimension "version"
applicationId "org.settingsdeployer"
versionCode 4
versionName "1.2"
}
french {
dimension "version"
applicationId "org.settingsdeployer"
versionCode 5
versionName "1.2_fr"
}
}
}
more details at Configure build variants
WARNING: Configuration 'compile' is obsolete and has been replaced
with 'implementation' and 'api'. It will be removed at the end of
2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: org.settingsdeployer
This warning is telling that we need to use either api or implementation to replace the compilation when adding dependencies. So, change the dependencies block to something like this;
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:21.0.3'
}
I've been working on my android location project and after I pasted the placeAutocompleteAdapter and started building the project but I get this compiler error of this.
I've been able to resolve the problem above but after running my project, the app crashed on launch and after checking the logcat I found this error
(06-01 12:54:33.920 30570-30570/com.example.sachiewerk.nearby_place E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.sachiewerk.nearby_place, PID: 30570
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbo;
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5974)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5545)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5484)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1595)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbo" on path: DexPathList[[zip file "/data/app/com.example.sachiewerk.nearby_place-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.sachiewerk.nearby_place-2/lib/arm, /system/lib, /vendor/lib, /system/vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5974)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5545)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5484)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1595)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
)
. Can anyone help me out? I don't know where this error came from because I tried checking my build.gradle file but didn't find any error there.
Below is the build.gradleenter code here
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.sachiewerk.nearby_place"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-places:15.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
compile 'com.google.android.gms:play-services:11.0.4'
}
You need to use the same version of Google Play Service. In your build.gradle, you have multiple dependencies of Google play service. You need to remove the following line:
compile 'com.google.android.gms:play-services:11.0.4'
Furthermore, you must not use the above code because it includes all the play service library. Instead, follow this rule:
Don't use the combined play-services target. It brings in dozens of
libraries, bloating your application. Instead, specify only the
specific Google Play services APIs your app uses.
I am having trouble with dependencies for Elasticsearch High Level Java Client 6.2.2 in Android Studio 3.0.
I have alot of duplicate files in my META-INF directory and sub-directories. I've tried using packagingOptions, doesn't work. Other things that doesn't work
Using default compiler instead of D8
Use older version of Gradle.
Turned off instant run.
Advanced profiling is not on.
Invalidate/manually delete cache.
my app/libs is empty.
I can't exclude group: 'org.apache.httpcomponents', module: 'httpclient' because I'm using the client.
The only thing that will get the app to run is change implementation 'org.elastic... to compileOnly. But this means I cant call the functions at run time.
I am new to android and this is driving me nuts. Should I start poking around in libraries folder .idea\libraries and changing some of these paths? Could this be where the problem is?
Here is the Gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com. .myapplication"
minSdkVersion 26
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
buildToolsVersion '26.0.2'
productFlavors {
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.1'
implementation 'org.elasticsearch.client:elasticsearch-rest-high-level-
client:6.2.2'
annotationProcessor 'org.apache.logging.log4j:log4j-core:2.9.1'
}
This is the error I'm currently getting. With bad formating
Error:com.android.builder.dexing.DexArchiveBuilderException:
Failed to process C:\Users\mmmmmm\.gradle\caches\modules-2\files-
2.1\org.elasticsearch\elasticsearch\6.2.2\16b3f7a7a31b89144723eb85c0583234842f68
4\elasticsearch-6.2.2.jar
Error:com.android.builder.dexing.DexArchiveBuilderException:
java.lang.RuntimeException: java.lang.IllegalArgumentException
Error:java.lang.RuntimeException: java.lang.IllegalArgumentException
Error:java.lang.IllegalArgumentException
Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException:
com.android.builder.dexing.DexArchiveBuilderException:
com.android.builder.dexing.DexArchiveBuilderException: Failed to process
C:\Users\mmmmm\.gradle\caches\modules-2\files-
2.1\org.elasticsearch\elasticsearch\6.2.2\16b3f7a7a31b89144723eb85c0583234842f684\elasticsearch-6.2.2.jar
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.1'
defaultConfig {
applicationId "com.example.calendarquickstart"
minSdkVersion 11
targetSdkVersion 24
versionCode 1
multiDexEnabled true
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'])
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'pub.devrel:easypermissions:0.1.5'
compile('com.google.api-client:google-api-client-android:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-calendar:v3-rev210-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
}
I am trying to use google API for calendar but I am getting following error while running the app"
Information:Gradle tasks [:app:clean, :app:generateDebugSources,
:app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies,
:app:generateDebugAndroidTestSources, :app:assembleDebug]
Error:Execution failed for task
':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: No dex files
created at
C:\Users\user\AndroidStudioProjects\CalendarQuickstart\app\build\intermediates\transforms\dex\debug\folders\1000\10\guava-jdk5-17.0_bbc68f1b67df2c58337cd00757b7bfd105bb5573"
I am following the steps from this link
What changes need to be done in gradle file for running this app?
Try enabling the multidex support in your build.gradle file as stated in Configuring Your App for Multidex with Gradle:
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
Additional reading:
Android application (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536—including Android framework methods, library methods, and methods in your own code. In the context of computer science, the term Kilo, K, denotes 1024 (or 2^10). Because 65,536 is equal to 64 X 1024, this limit is referred to as the '64K reference limit'.
Getting past this limit requires that you configure your app build process to generate more than one DEX file, known as a multidex configuration.
I created new Android Project and tried to run tests (JUnit) and had follow result:
15:28:53: Executing external tasks 'cleanTest test --tests com.binomv.rimidalv.tt.*'...
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'TT'.
Could not resolve all dependencies for configuration ':classpath'.
Artifact 'kxml2.jar (net.sf.kxml:kxml2:2.3.0)' not found.
Searched in the following locations:
https://jcenter.bintray.com/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 0.512 secs
Artifact 'kxml2.jar (net.sf.kxml:kxml2:2.3.0)' not found.
Searched in the following locations:
https://jcenter.bintray.com/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar
But if i use test through device - it is ok.
Thank you.
-----UPDATE-----
build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.binomv.rimidalv.tt"
minSdkVersion 14
targetSdkVersion 22
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:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
}
----- SOLUTION -----
You should remove "~/.gradle" folder. Android Studio recreate it.