Receiving the following message when uploading my latest APK:
You need to use a different version code for your APK because you already have one with version code 1.
I am setting the android:versionCode and android:versionName correctly (in /app/src/main/AndroidManifest.xml):
android:versionCode="2"
android:versionName="1.1"
Also, I am using the same keystore that the project was initialized / originally built with
This is my 5th app and I've never encountered this issue before.
Is there some other place within a typical Android app project that could override the versionCode found in the AndroidManifest.xml file? Or maybe some kind of "de-linter" tool that'll help?
The path names suggest you're using Android Studio. Android Studio is using the Gradle build system. Possibly the build.gradle files specify version name/code that override whatever you set in manifest. So, to change it, edit your build.gradle file(s) and check for overridden versionCode / versionName.
Clean your app. Then save all files and then build
Related
I am trying to run the app on my Android 10 device from the Android Studio and the following error is shown -
10/17 09:16:05: Launching 'app' on Physical Device.
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_OLDER_SDK
List of apks:
[0] 'C:\Users\WELCOME\AndroidStudioProjects\BottomNav2\app\build\outputs\apk\debug\app-debug.apk'
The application's minSdkVersion is newer than the device API level.
Retry
I think I have to change the minSdk value, but in which file and how to do it?
The device you are using has lesser API than minimum required API set by you. So, either you can create another physical device with API 30, or you can create another project with lesser API.
If you wish to change it in the already existing project, you can go to build:gradle(app). There under default config, you will find minSDKVersion, you can change it from there and then sync project with gradle files. You will see the sync button on top right of the editor after making changes.
I wanted to start developing for the Sony Smartwatch 2 I just got.
This is where the problems started. I found many official articles about downloading and setting up the Sony Add-on SDK.
But here's the dark side:
It is not available anymore from Sony's dev site, so I could not add it by using the Android SDK manager .
After lots of sweat I managed to find it only here.
Which is the 2.0 version.
I unzipped it into my /[SDK]/add-ons/sony_add-on_sdk_2_0 folder, and set up Eclipse (4.6.3) with the following SDK manager settings:
SDK settings
First it reported the Sony SDK broken, but I found in another topic that I should add a source.properties file, in order to make it work, which has the following header:
### Android Tool: Source of this archive.
#Wed Feb 28 14:14:39 CET 2018
Addon.NameDisplay=SONY ADD-On SDK
Addon.NameId=sony_add_on
Addon.VendorDisplay=SONY
Addon.VendorId=sony
AndroidVersion.ApiLevel=16
Pkg.Desc=Android + Google APIs
Then it became visible for the Eclipse
When I try to build the SamplePreferenceActivity it is imported with SmartExtensionsAPI and SmartExtensionsUtils but one after the other as I read this can make errors too, in the following order:
API
Utils
Sample
which has the following properties:
Properties for SmartExtensionAPI
Properties for SmartExtensionUtils
With these settings I still get error in:
/SmartExtensionUtils/src/com/sonyericsson/extras/liveware/extension/util/widget/NotificationWidgetExtension.java
saying
SmartWatchNotificationWidgetImage cannot be resolved to a type
and in
/SamplePreferenceActivity/res/layout/item_gallery.xml
saying:
Couldn't resolve resource #style/Widget.Holo.ActionMode Couldn't
resolve resource #dimen/smart_watch_2_control_width You must supply a
layout_width attribute. Couldn't resolve resource
#dimen/smart_watch_2_text_size_large
"#dimen/smart_watch_2_text_size_large" in attribute "textSize" is not
a valid format. Couldn't resolve resource
#dimen/smart_watch_2_text_size_medium
"#dimen/smart_watch_2_text_size_medium" in attribute "textSize" is not
a valid format.
What am I missing here? Should I use a completely different setup? Is this because I had to manually add the SDK to Eclipse? If you need anything else to understand the problem properly, feel free to ask me, thanks for helping me!
I have a problem with my Android project and Gradle 1.5.
I am not able to compile my dependencies I added. Currently I am developing an Java EE application and I want to perform an EJB lookup from my Android device to my running Wildfly10.
I know, doing a lookup from an android device might not be the best option, a REST webservice would be better, but thats not the point here.
In my project I added a new module, containing all my external libs, and I added this module to my :app as dependency on "compile" level. Everything just works fine, until I want to add the jboss-client.jar. During dex, he is complaining about the javax.transaction.*.
What I have done for now
added multiDexEnabled true
added preDexLibraries false
playing around with all other dex options
also I tried this: Android dx tool
this: Android Studio ignore --core-library flag
and set the --core-library flag in Android Studio settings
Why they are not working
solution: I modified my dx.bat in every build-tool I have .. nothing changed. It's just not working
solution: com.android.build.gradle.tasks.Dex is not known (and I have no idea how to add), coreLibrary is not supported with Gradle 1.5
solution: is completely ignored by gradle
The projects minSDK is 19 and targetSDK is 23 with build-tool 23.0.2
I called the dx.bat from command-line with the same parameters as gradle, I only added the --core-library arg and it works! But that doesnt solve the problem within Android Studio and Gradle.
Can anyone please help me?
UPDATE:
Okay, I had a look at the source code of com.android.dx.command.Main. There is a public inner class "Arguments" which contains (apperently) the arguments which can be used, also the coreLibrary=false. Now I only need to know how to modify it. Does anybody know?
Best regards,
Chris
This worked for me:
dexOptions {
preDexLibraries = false
additionalParameters =["--core-library"]
}
Can anyone please help me with this? I dont know what does this mean.
To give you a back up I updated my sdk with 23 and then i got 101 errors regarding HTTPClient not being resolved. So i followed this link to remove that then I have this error of which i have no clue where to start with.
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\build-tools\23.0.1\dx.bat --dex --no-optimize --output F:\sagarDevanga\workspace\AndNrby\app\build\intermediates\dex\debug --input-list=F:\sagarDevanga\workspace\AndNrby\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lorg/apache/http/ConnectionClosedException;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
Make sure that your adt supports the version of api that you are running. See this link : https://developer.android.com/tools/support-library/index.html
To fix you should check in libs (.jar) and in your build.gradle if there are some libraries duplicated. This error happen tipicaly when you add a copy of the same library or a library that include a copy of another library that you have already added
Update also your support libs from SDK
Ok I have updated the question's title also so that other people also find it useful.So I will write a detailed answer about how this error occured in my project and the fixes I did and how I finally derived the answer.
1) I updated the SDK and then started to compile my project using the latest api i.e API 23. You can do that by going to File -> Project Structure ->Select your module.
Now in the right hand side window under properties the top two properties can be changed using in the drop down.
Then click on Apply and Ok.
2) So when you do this your app's build.gradle file will look like this. And now everything looks good. It will compile also. But when you run the project you will get a lot of errors by this name Error:(17, 35) error: package org.apache.http.impl.client does not exist Obviously if you are using them in your async tasks.
3) So when i got this error I did a lot of research here and there and then came across this link and added the HTTP CLIENTS jar files in the libs folder and then tried to run the program I ended up with this problem (problem mentioned in the question).
4) So after diggin around I found that the problem was HTTP methods which i used in the Async task were deprecated in the API 23 hence I landed myself in this mess.
5) Then what I did next fixed the problem for me. Refernce given here.
6) In your module's build.gradle file add this line useLibrary 'org.apache.http.legacy' like below.
7) Wait your still not done. Now go to your main build.gradle file and add this line classpath 'com.android.tools.build:gradle:1.3.1' like this . Now build and compile your project everything runs fine.
8) After all this steps the project works fine but I have a doubt in the last pic that i shared which is of the top level build.gradle file. Whether I should keep both the classpaths or just use this classpath 'com.android.tools.build:gradle:1.3.1' and remove the other one. If any one have any idea on this please help.
9) The problem was that they deprecated the HTTP Clients in the Latest Android API 23. Insted of HTTP Client you have to use HttpUrlConnection but if you want to continue using HTTP client for NOW follow the steps above.
Seriously, i don't know what to do to solve this problem.
My android project was working fine, until i needed to import a library with Maven. Since that, everything started to collapse.
What is happening: When i start my application, the following error appears on LogCat and android tells that my app stopped working. I've searched for this similar error here AND on the rest of the internet, but everything people did haven't worked for me.
Error:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.buscaserra/com.buscaserra.main.ActivitySplash}: java.lang.ClassNotFoundException: Didn't find class "com.buscaserra.main.ActivitySplash" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.example.buscaserra-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.buscaserra-2, /vendor/lib, /system/lib]]
Manifest and packages:
Build Path:
Same problem here.
What worked for me was adding android-support-v4.jar as a lib and making sure it was checked on Project properties -> Build Path -> Order & export.
It was mentioned here
I had the same problem when I moved the project folder from a Linux machine to a Mac.
What I did was:
Close the project
Remove the .iml file
Import the project using the "Create new project using existing code"
I am using IntelliJ.
Cheers.
I did the following steps to resolve the issue on Android Studio.
open file ./app/build.gradle
reduce compileSdkVersion (e.g. 22 -> 21)
click 'sync project with gradle file'
change back to the original compileSdkVersion (e.g. 22)
click 'sync project with gradle file'
recompile and it should work.
I have spent way to many hours on this stupid issue but finally got it resolved:
When creating a new project -> package name is causing this stupid dex issue to appear, must not be able to find the main activity during run time with whatever deployment assemply setup. Android Studio doesn't like some of my commonly used package names, I'm completely baffled..I think this is a pretty big bug haha
Given the following new project parameters:
Name: NotificationApp,
packageName: com.stores.business.notificationapp,
saveLocation: /home/me/AndroidStudioProjects/NotificationApp
I would get the following error:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.stores.business.notificationapp/com.stores.business.notificationapp.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.stores.business.notificationapp.MainActivity" on path: DexPathList[[zip file "/data/app/com.stores.business.notificationapp-2/base.apk"],nativeLibraryDirectories=[/data/app/com.cvs.stores.myapplication-2/lib/arm64, /vendor/lib64, /system/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
My Solution
I resolved it by changing the package name to:com.notificationapp, then File->invalidate caches/Restart..hope this helps someone else haha
Do you have any required projects on the build path? Can't tell from your screen shot but check your "Projects" tab. You may have inadvertently added a Project Library as a required project instead. Remove the project from the Projects tab and then project -> properties. Click Android, add the project as a library instead here...
Make sure that any compatibility lib jars that you're using in your main project (like android-support-v4.jar) are the same versions as those used in any of the projects that your main project references.
I had this same problem and what solved it was to copy and paste the android-support-v4.jar from another library project (that my main project was referencing) and pasting it into my main project's /libs folder.
I had the same issue.
Nothing had changed except Android studio and Gradle updated since I last compiled.
I took a look at the build options under Build>Edit Build Types and noticed that the one option that was different between my project that didn't run and the ones that did work was the Minify Enable option.
I set it to false and now everything works again.
I should understand the problem by just seeing "dex errors".But it took half day to fix the issue.
I fix this by following android developers page's instruction: https://developer.android.com/studio/build/multidex.html
First add this to my gradle.build:
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
Then I extend my Application class (or declare the application class in AndroidManifest.xml or override attachBaseContext() function) as instructed by the MultiDexApplication class document on the page. This have fixed my problem.