Setting up dexguard license file in android studio - android

I didn't find dexguard-license.txt file in dexguard.please help me in gradle setup in android studio
here is my gradle console output
Executing tasks: [:app:assembleDebug]
.....
Can't find a DexGuard license file.
You should place your license file dexguard-license.txt
1) in a location defined by the Java system property 'dexguard.license',
2) in a location defined by the OS environment variable 'DEXGUARD_LICENSE',
3) in your home directory,
4) in the class path, or
5) in the same directory as the DexGuard jar.

It's been a while since there was an updated answer, so I thought I'd update since there have been a change to DexGuard's license file setup.
I just updated from Android Studio version from 2.2.3 to 2.3 and also upgraded my Gradle version from 2.14.1 to 3.3. Upon upgrading to Gradle version 3.3, I received the same error that was documented by the OP:
Can't find a DexGuard license file.
You should place your license file dexguard-license.txt
1) in a location defined by the Java system property 'dexguard.license',
2) in a location defined by the OS environment variable 'DEXGUARD_LICENSE',
3) in your home directory,
4) in the class path, or
5) in the same directory as the DexGuard jar.
My DexGuard configuration was working just fine using Gradle version 2.14.1 with my dexguard-license.txt file in the same directory as the DexGuard jar (suggestion #5).
It turns out that the documentation for DexGuard states the following:
Note: when using Gradle 3.1+, the license file will not be found anymore when placed in the same directory as the DexGuard plugin jar.
(Source: DexGuard 7.3.10 documentation -> Quick Start -> Setting up your license file)
I wanted to keep my license file in the same directory as the DexGuard jar, so I implemented suggestion #1. I did this by adding the following line to my project's gradle.properties file:
systemProp.dexguard.license=./app/libs/Dexguard_7_3_10
Note that my DexGaurd jar and my dexguard-license.txt files are located in the following directory: {project folder}/app/libs/DexGuard_7_3_10/
I went with this solution as I not only build locally but also on a Jenkins CI. This solution prevents me from having to implement any changes on the build server itself (i.e. local environment variable, copying files to server home directory, or class path options). I hope this helps someone else that stumbles upon this problem and finds the error message confusing.

You should copy dexguard-license.txt file and dexguard.jar file to your home directory(: /user/ironman).

The licence file is available to download once you've logged in on the account > files page on https://www.guardsquare.com
See this screen shot

If you have dexguard-license.txt then you can define it under build.gradle as follows.
dexguard {
version = '9.1.+'
// Keep the license secure in your CD/CI
**license = '/../YOURDIRECTORY/dexguard-license.txt'**
configurations {
release {
..
..
}
}

Related

i'm using Android Studio 3.5.3 . inside my android project "local.properties" file code automatically changed what is the reason

after i restarted project then my project level all gradle file code changed due to below denoted problem. sir now my intension is what is the reason to aumatically chaged my local.properties file. if our one file issue found then our whole project going to crash.this problem of android studio i facing lots of time what is the reason please anybody give me solution
before local.properties file code
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=C\:\\Users\\ajay\\AppData\\Local\\Android\\Sdk
after autimatically chaged local.properties file
Êþº¾ 3 ˆ
ƒ … † abc_action_bar_home_description I
ConstantValue abc_action_bar_up_description $abc_action_menu_overflow_description abc_action_mode_done !abc_activity_chooser_view_see_all *abc_activitychooserview_choose_application abc_capital_off abc_capital_on abc_font_family_body_1_material abc_font_family_body_2_material abc_font_family_button_material
abc_font_famil
Try to open local.properties file locally in a text editor, and see if you still get the same result.
There seems to be a problem with your Android Studio. I would suggest downloading Android Studio from its official website, and then reopen your project in there.
EDIT
If local.properties is corrupted locally, then you will need to reinstall android studio and import your project again. Are your gradle build scripts corrupted as well or is it just the local.properties file? If multiple files are corrupted then either Android Studio is corrupted or some other background service or malicious program is causing havoc in your file system. What OS are you on? (I hope not windows)

Android Studio: Unable to build app due to gradle distribution url error

I know this question has been asked before but I haven't been able to fix the issue. I am running Android Studio version 3.1.4. I am trying to run an app that I cloned from a Github repository. But even before I try to run it, I get this error:
my-app: sync failed
Cause: https://downloads.gradle.org/distributions-snapshots/gradle-4.4-20171031235950+0000-all.zip
How do I fix this error? Thanks in advance.
You can check and change the distribution url in the properties file $rootDir/gradle/wrapper/gradle-wrapper.properties. See property distributionUrl.
Value should be something as follows (update the gradle version depending on your Android Studio version)
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
I've encountered a similar error when I tried importing the Sunshine project from the Udacity Android development course. I fixed the issue by downloading the mentioned zip file and extracted it to the C:\Users\<username>\.gradle\native folder.
Then in Gradle settings, use local Gradle distribution and set the Gradle home path to the downloaded gradle folder.
Check this video for more information
You can fix it by the following steps: (currently using Android 3.6.3)
This worked for me.
Exit android studio then make the below changes.
Go to C:\Users\UserName.android and rename the build-cache folder to build-cache.bak.
Go to C:\Users\UserName.AndroidStudio3.6\system and rename these folders:
caches to caches.bak
compiler to compiler.bak
compile-server to compile-server.bak
conversion to conversion.bak
external_build_system to external_build_system.bak
frameworks to frameworks.bak
gradle to gradle.bak
resource_folder_cache to resource_folder_cache.bak
Open the Android Studio and open your project again.
If the folder is not in the Android3.6 folder, move to the next step.
Find the Gradle version from the gradle-wrapper.properties file
Download the Gradle bin file from internet, then extract it.
File menu-->Settings-->Build & Tools-->Gradle-->Use Gradle from: From
drop down select a specified location and browse to the location
where you have saved the Gradle bin zip file. (Default settings is use from ;gradle-wrapper.properties' file)
4.File menu-->Invalidate caches and re-run
[Gradle properties file]
[Gradle settings]

Where to put local settings for Android gradle build

I am not sure where to properly put local properties for a project (a file path in this case) for an Android Studio project built with gradle:
local.properties: That would be what I need, however it is autogenerated and just used for the SDK-location
gradle.properties (Project level): This file is checked into version control for us to guarantee the same JVM settings for all project members for example
gradle.properties (Global): This would be possible, however I don't feel it is the correct place to put project specific settings
So either I overlooked a possibility or I must go the way of ignoring the project level gradle.properties
local.properties: You can put informations about the SDK location but also, your sensitive data like username and password of your repo access and the location of your Key to sign the Apks.
gradle.properties (Project level): It's only specified for the current project (or module) it contains dependencies, plugins, tasks, repositories for that project.
gradle.properties (Global): Can contains same data as gradle.properties (Project level) except adding dependencies. Configuration in this file are taken for all subProjects (modules in that project). this file can be located also in your gradle home directory (userDir/.gradle). If you are working with a Proxy, the best place to configure your proxy is that file.
If you want to put something specific in the local.properties then just over write once its being generated depending on the OS you have. It generates the SDK location by default but you can override like this from command line:
echo 'sdk.dir=/home/jenkins/Android/Sdk' > ./local.properties
Then you can run your gradle to build the project.

Error:An error occurred configuring project ':app'. > The SDK directory does not exist

i am importing one project. i am running this on linux. but when i build my project it gives me this error.
**Error:A problem occurred configuring project ':app'.
The SDK directory '/home/custom/Documents/Zebra_RFID_Mobile-1.0.2.17/C:\Users\DHXW76\AppData\Local\Android\Sdk' does not exist.**
Below is my local.properties file
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Mon Sep 11 14:54:05 IST 2017
ndk.dir=/home/custom/Android/Sdk/ndk-bundle
sdk.dir=/home/custom/Android/Sdk
I am wondering that how is this error showing c:\users.... path, although i am trying it to run this on linux.
I have also checked my sdk location, it is perfect. can anybody help me solve this issue?
I had this problem. I'm using Linux.
Project stucture windows
How I corrected the error:
Need to check SDK Manager. Is the SDK similar to your project?SDK Manager
2.Checking Gradle.Gradle Folder Gradle
The version number in the Project Structure /project and in the /opt/android-studio/gradle/gradle-4.6/ folder should be the same. If the problem persists, update the Gradle.
2.1 We go to the site: https://gradle.org/install/#with-a-package-manager and download the binary version. Download the archive we throw in the folder /opt/android-studio/gradle/gradle-4.6/ and write down its version number in Project Structure /project.
3.Restart the studio.
If the program code shows an incorrect version of Gradle, then an error will appear that is difficult to fix. Try to check all the code or create a new project.
Check Gradle easily by creating a new project. I like this method.

Apk location in New Android Studio

I started using new Android Studio and cant find the APK of the application in IDE,where it actually locates?
To help people who might search for answer to this same question, it is important to know what type of projects you are using in Studio.
Gradle
The default project type when creating new project, and the recommended one in general is Gradle.
For a new project called "Foo", the structure under the main folder will be
Foo/
settings.gradle
Foo/
build.gradle
build/
Where the internal "Foo" folder is the main module (this structure allows you to create more modules later on in the same structure without changes).
In this setup, the location of the generated APK will be under
Foo/Foo/build/apk/...
Note that each module can generate its own output, so the true output is more
Foo/*/build/apk/...
EDIT
On the newest version of the Android Studio location path for generated output is
Foo/*/build/outputs/apk/...
IntelliJ
If you are a user of IntelliJ before switching to Studio, and are importing your IntelliJ project directly, then nothing changed. The location of the output will be the same under:
out/production/...
Note: this is will become deprecated sometimes around 1.0
Eclipse
If you are importing Android Eclipse project directly, do not do this!
As soon as you have dependencies in your project (jars or Library Projects), this will not work and your project will not be properly setup.
If you have no dependencies, then the apk would be under the same location as you'd find it in Eclipse:
bin/...
However I cannot stress enough the importance of not doing this.
I am on Android Studio 0.6 and the apk was generated in
MyApp/myapp/build/outputs/apk/myapp-debug.apk
It included all libraries so I could share it.
Update on Android Studio 0.8.3 Beta. The apk is now in
MyApp/myapp/build/apk/myapp-debug.apk
Update on Android Studio 0.8.6 - 2.0. The apk is now in
MyApp/myapp/build/outputs/apk/myapp-debug.apk
There is really no reason to dig through paths; the IDE hands it to you (at least with version 1.5.1).
In the Build menu, select Build APK:
A dialog will appear:
If you are using a newer version of Android Studio, it might look like this:
Clicking the Show in Explorer or locate link, you will be presented with a file explorer positioned somewhere near wherever Android Studio put the APK file:
But in AS 3, when you click locate, it puts you at the app level. You need to go into the release folder to get your APK file.
In my case, I'm using Android Studio 1.0.2, I get my APK file from:
<myAndroidProject>/app/build/outputs/apk/app-debug.apk
If anyone would be missing his APK and couldn't find it in the locations stated in other answers (I found this question, since I couldn't find it either) it might just be in this folder (mine was)
<project folder>/target/classes/<appname>.apk
I also had a there this file:
<appname>.unaligned.apk
I am not perfectly sure, whether the apk is actually the full-blown apk, which should be generated, but I tried it on various devices (not only the target device, but also those which were supporting only the minimum SDK) and it worked.
Hope this will help someone.
It is Project_Location/app/build/outputs/apk for Gradle Project
Find apk using below step:-
Goto to your project folder.
Open project folder.
Open build folder.
Open output folder.
Open apk folder.
Now you see your apk.
hope it will help some body.
So the apk in Android studio is generated inside build folder of app module.
Correct path to apk would be \app\build\outputs\apk. I am using Android Studio Version 1.4.1. So apk could either be found at app/build/apk/ or \app\build\outputs\apk base on the version of Android studio you are using. Refer the below image
Also find more reference on these links.
Building and Running from Studio
Studio Project Overview
I'm using Android Studio and gradle.
It created the build/apk/<.apk> file only when I ran the project.
Press the following to run your project: Alt+u, u
Android Studio: 0.5.3
Gradle: 0.9.+
You can find the APK in:
YourProject\app\build\outputs\apk
The .apk file is located at [your project]\out\production\[your project name]
In the new Android Studio, the signed apk is placed directly in the folder of module for which the apk is built.
For example: For a Project ProjectA containing 2 modules Mod1 and Mod2, the apk files will be found in
/path-to-ProjectA/Mod1/Mod1.apk
/path-to-ProjectA/Mod2/Mod2.apk
Image for APK location in Android Studio
Location of apk in Android Studio:
AndroidStudioProjects/ProjectName/app/build/outputs/apk/app-debug-unaligned.apk
As of version 0.8.6 of Android Studio generating an APK file (signed and I believe unsigned, too) will be placed inside ProjectName/device/build/outputs/apk
For example, I am making something for Google Glass and my signed APK gets dropped in /Users/MyName/AndroidStudioProjects/HelloGlass/glass/build/outputs/apk
I got the .apk files in
parent_folder/out/production/projectname/projectname.apk
Build your project and get the apk from your_project\app\build\apk
You can find your apk file as follow:
yourproject>app>build>output>apk>yourproject.apk
The Android build system is the toolkit you use to build, test, run
and package your apps. The build system can run as an integrated tool
from the Android Studio menu and independently from the command line.
You can use the features of the build system to:
Customize, configure, and extend the build process.
Create multiple APKs for your app with different features using the
same project and modules.
The build process involves many tools and processes that generate intermediate files on the way to producing an .apk. If you are developing in Android Studio, the complete build process is done every time you run the Gradle build task for your project or modules.
The build process is very flexible so it's useful, however, to understand what is happening under the hood since much of the build process is configurable and extensible. The following diagram depicts the different tools and processes that are involved in a build:
Build a release version
You can now use the Build menu options to build the release version of your application for distribution.
The build generates an APK for each build variant: the app/build/apk/ (or app/build/outputs/apk) directory contains packages named app--.apk; for example, app-full-release.apk and app-demo-debug.apk.
Build output
The build generates an APK for each build variant in the app/build folder: the app/build/outputs/apk/ directory contains packages named app--.apk; for example, app-full-release.apk and app-demo-debug.apk.
Courtesy goes to Build System Overview
I am using Android Studio 3.0 canary 6.
To build apk,
Click to Build->Build APK(s).
After your apk is build, Go to:
C:\Users\your-pc-name\AndroidStudioProjects\your-app-name\app\build\outputs\apk\debug
If you have imported a Project from Eclipse and are using the new Android Studio
The directory
/bin
does exist (there maybe old binaries in here) however with the latest Android Studio update the actual current apk is stored in
/out/production
Add this in your module gradle file. Its not there in default project. Then u will surely find the APK in /build/outputs/apk/
buildTypes {
debug {
applicationIdSuffix ".debug"
}
}
open Event Log
find line: Module 'app': locate or analyze the APK.
click on locate link to open folder with apk file!
After all: "All built APKs are saved in project-name/module-name/build/outputs/apk/ Build your project LINK
Hint: If you can´t see the app-debug.apk in your debug folder, you have to click on BUILD --> Rebuild Project in Android Studio.
To create apk in android studio,go to build menu->build bundles/apk->build apk
it will make the apk file of your project.After this the apk will be available in your
project directory->app->build->outputs->apk->debug->app-debug.apk
Click on Build-Build Bundles/Apks-Build Apk.
A notification will which shows app location when you click on 'locate' on the notification.
If you have already done creating apk, goto : C:\Users\\AndroidStudioProjects\\app\build\outputs\apk\debug
For Gradle look here: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.SourceSetOutput.html.
"For example: Java plugin will use those dirs in calculating class paths and for jarring the content; IDEA and Eclipse plugins will put those folders on relevant classpath."
So its depend on plugin build in configs unless you don't define them explicit in config file.
Click the little gear icon in the project view and make sure "show excluded files" is checked. Otherwise, the IDE will hide output and several other important directories under $project/$module/build/.
Hello all above all answers are right you can find the apk through the path in android studio but there is exceptions you can't find the build/output
folder some times if you can't see it just go to
app--> app.iml file and find below line in it :-
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
--> after removing this line you can see the output folder its just the adding more information to above answers as per my experience :)
THANKS!~!
For Android Studio 2.0
C:\Users\UserName\AndroidStudioProjects\MyAppName\app\build\outputs\apk
Here
UserName is your computer user name and
MyAppName is your android app name
As of Android Studio 3.0 / Gradle Build Tools 3.0.0, APK artifacts can now be found in foo/bar/build/outputs/apk/flavorName/buildType with respect to your project name, foo, and your module name, bar. There is now a directory for each apk file sorted organized first by flavor (with respect to flavor dimensions) and then by build type.

Categories

Resources