Unable to generate unassigned apk file - android

I am trying to generate an apk file from edit configurations / + / Gradle/ assemle but no file is generated. After editing the configurations, I tried to make project, rebuild and clean but there is nothing in the output folder. I also tryed to press Run but I get this error:
Executing tasks: [assemble]
Configuration on demand is an incubating feature. NDK is missing a
"platforms" directory. If you are using NDK, verify the ndk.dir is set
to a valid NDK directory. It is currently set to
C:\Users\steve\AppData\Local\Android\Sdk\ndk-bundle. If you are not
using NDK, unset the NDK variable from ANDROID_NDK_HOME or
local.properties to remove this warning.
NDK is missing a "platforms" directory. If you are using NDK, verify
the ndk.dir is set to a valid NDK directory. It is currently set to
C:\Users\steve\AppData\Local\Android\Sdk\ndk-bundle. If you are not
using NDK, unset the NDK variable from ANDROID_NDK_HOME or
local.properties to remove this warning.
Incremental java compilation is an incubating feature.
FAILURE: Build failed with an exception.
What went wrong: Could not determine the dependencies of task ':library:apklib'.
Task with path 'packageReleaseJar' not found in project ':library'.
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: 1.296 secs
Any idea what to do, to create apk file? I am a little lost.
I am using android studio 2.3.1 and gradle:2.3.1

For anyone who has the same problem, I was able to generate apk file from:
Build / Build Apk

Related

Could not find method google() for arguments [] on repository container. (flutter)

cmd > flutter run
Launching lib\main.dart on Lenovo A6020a40 in debug mode...
Initializing gradle... 1.8s
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "C:\Users\Mantu Kumbhakar\Downloads\sytody-master\android\gradlew.bat" exited abnormally:
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\Mantu
Kumbhakar\AppData\Local\Android\sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
BUILD FAILED
Total time: 3.065 secs
Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence.
FAILURE: Build failed with an exception.
Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 27
What went wrong:
A problem occurred evaluating script.
Could not find method google() for arguments [] on repository container.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Command: C:\Users\Mantu Kumbhakar\Downloads\sytody-master\android\gradlew.bat app:properties
This error is sometimes generated when you try to run a project created using an older version of Flutter than the one you're currently using.
The issue can also be found on the Flutter GitHub repository.
Until an official solution to this issue is provided, you can fix it by recreating the project with your newer version of Flutter, as suggested in the above GitHub issue too.
Above, when Abhijeet said: "This error is sometimes generated when you try to run a project created using an older version of Flutter than the one you're currently using." is correct.
Causes
When a project is created with flutter create foo several files in the ios/ and android/ sub-directories are created.
Newer Flutter versions might generate these files a bit differently and projects created with older Flutter versions might cause issues.
to fix:
Supposing that your project is in c:\root_of_your_project\name_of_your_project
Delete the ios/ and android/ directories and go to root directory of your project with CMD, and:
c:\root_of_your_project\flutter create -a kotlin name_of_your_project
and
c:\root_of_your_project\flutter create -i swift name_of_your_project

Unity ARFoundation Gradle build fails - last-build.bin access denied

I am trying to build in Unity its ARFoundations AR example for ARCore (https://github.com/Unity-Technologies/arfoundation-samples) using Unity's Gradle build option but fails as shown below.
What went wrong:
Could not update C:\Users\user\.gradle\caches\4.0.1\file-changes\last-build.bin
C:\Users\user\.gradle\caches\4.0.1\file-changes\last-build.bin (Access is denied)
I don't know much android studio, can you please give me guidance what this may relate to?
Thanks a bunch for your help , Sergio
My setup:
Unity 2018.1.6. ARFoundation, AR Core XR Plugin, ARKit XR Plugins
installed via package manager
Build setup: ARFoundation scene example, Building on Gradle, min API
7.0 max highest installed, Target Architecture ARMv7, multithreaded rendering off
jdk1.8.0_172, Android sdk 3.1.3
Fails the same with Development build toggled on and off
Error:
CommandInvokationFailure: Gradle build failed.
C:\Program Files (x86)\Java\jdk1.8.0_172\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2018.1.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx1024m" "assembleRelease"
stderr[
FAILURE: Build failed with an exception.
What went wrong:
Could not update C:\Users\user.gradle\caches\4.0.1\file-changes\last-build.bin
C:\Users\user.gradle\caches\4.0.1\file-changes\last-build.bin (Access is denied)
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED in 45s
]
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0021f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:182
at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00065] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:89
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
quick update in case this can be helpful to anyone who had a similar problem.
resolved it by simply selecting the properties of the gradle folder in c directory and settings its Attributes to not read-only and unhide files.
Cheers, Sergio
Go C:\Users\user and remove from hidden .gradle folder by right click.
Also Go security and apply all permisions

SDK Location not Found In Gradle Command Line Linux

I am trying to build my project using fdroid but it keeps failing when it gets to gradle. The project builds well in android studio but it always fail in gradle command line. I have search google multiple times but i could not get help from any website. I have set my ANDROID_HOME to /home/collins/Android/Sdk but it seems gradle ignores the variable, Each time i try to build, i noticed that gradle generates a local.properties file with the wrong sdk location value:
sdk.dir=$ANDROID_HOME
sdk-location=$ANDROID_HOME
I don't know if there is a way to set the global default value for any project in gradle. Here is the full log from fdroid build
INFO: Building version 3.0 (3) of com.simpledecredwidget
INFO: Getting source for revision 0ca18981c4b3825861b07e1f2444f711fc8a4fa5
INFO: Creating local.properties file at build/com.simpledecredwidget/local.properties
INFO: Creating local.properties file at build/com.simpledecredwidget/app/local.properties
INFO: Cleaning Gradle project...
ERROR: Could not build app com.simpledecredwidget: Error cleaning com.simpledecredwidget:3.0
==== detail begin ====
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/app/$ANDROID_NDK.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory '/home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/$ANDROID_HOME' does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
==== detail end ====
INFO: Build for app com.simpledecredwidget failed:
Error cleaning com.simpledecredwidget:3.0
==== detail begin ====
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/app/$ANDROID_NDK.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory '/home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/$ANDROID_HOME' does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
==== detail end ====
INFO: Finished.
INFO: 1 builds failed
EDIT
As you can see in the error above, The sdk location /home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/$ANDROID_HOME was used which was incorrect, i don't know where this bug is coming because a different value was set in local.properties file which value is sdk.dir=$ANDROID_HOME

react native run android in emulator throws erro

i install react native and open a new project.
i try to run
react-native run-android
and I get this error
PS E:\Projects\React native\myapp> react-native run-android
Scanning 574 folders for symlinks in E:\Projects\React native\myapp\node_modules (27ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
FAILURE: Build failed with an exception.
* Where:
Build file 'E:\⌠°σΘΘ≈ΦΘφ\⌠°σΘΘ≈ΦΘφ ≈Θ⌡\React native\myapp\android\app\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Your project path contains non-ASCII characters. This will most likely cause the build to fail on Windows. Please move your project to a different directory. See http://b.android.com/95744 for details. This warning can be disabled by adding the line 'android.overridePathCheck=true' to gradle.properties file in the project directory.
* 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: 2.877 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
As you can see from the error you need to move your project to a different directory with no non-ASCII characters.
Your project path contains non-ASCII characters. This will most
likely cause the build to fail on Windows. Please move your project
to a different directory. See http://b.android.com/95744 for details

Gradle cannot find the AndroidSDK path on Windows

I am just setting up a gradle build for a android project on a windows machine, after it has worked well on a mac. I have defined a local.properties file like so:
sdk.dir="C:\Program Files\android\sdk"
When attempting to use gradlew.bat I see the following:
C:\Users\PeterNied>gradlew
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\PeterNied\build.gradle' line: 9
* What went wrong:
A problem occurred evaluating project ':MyProject'.
> The SDK directory 'C:\Users\PeterNied\"C:Program Filesandroidsdk"' does not exist.
* 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: 3.224 secs
Clearly the computation of the android sdk directory is just combining the local directory and the destination that I specified C:\Users\PeterNied\"C:Program Filesandroidsdk". How do I point gradle to the right place?
Just using
sdk.dir=C:/Program Files/android/sdk
should work (in general, replacing backslashes by forward slashes).
The path separator and path concatenation are just the same issue.
There are two aspects of this problem, the path seperator, and dealting with the gradle local.dir + sdk.dir concatination:
You can swap the '\' -> '/' in order to prevent the the path seperators from getting lost
I've been unable to 'define' a root path for gradle to use instead, so I'm going to work around this problem by creating a path that will resolve to the right location like the following:
sdk.dir=../../Program Files/android/sdk
Its a little ugly, but it will get you building.

Categories

Resources