I open the project: ML Kit Vision Quickstart. https://github.com/googlesamples/mlkit/tree/master/android/vision-quickstart
Build and run on phone with no problem. I want to save an object created by the program with Shared Preferences but when I create a new object this error apear:
('PoseLandmark(int, com.google.mlkit.vision.common.PointF3D, float)'
is not public in 'com.google.mlkit.vision.pose.PoseLandmark'. Cannot
be accessed from outside package)
This class PoseLandmark is read only. And there is 2 clickable link "Download Sources" and "Choose Sources". When a go to the Download sources the task fails with the message:
Task :app:DownloadSources FAILED
1 actionable task: 1 executed
FAILURE: Build failed with an exception.
Where:
Initialization script '/tmp/ijmiscinit1.gradle' line: 20
What went wrong: Execution failed for task ':app:DownloadSources'.
Could not resolve all files for configuration ':app:downloadSources_0dad3cd2-2bde-4430-8d97-b0c59cc95ab3'.
Could not find com.google.mlkit:pose-detection-common:17.1.0-beta2#aar.
Required by:
project :app
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 5s 23:52:38: Task execution finished
'DownloadSources'.
I try to change this version on the gradle.build file from:
implementation 'com.google.mlkit:pose-detection:17.0.1-beta3
to:
implementation 'com.google.mlkit:pose-detection:17.0.1-beta2
but didn't work!
And I already try many things: invalidate cache/restart, remove .idea and .gradle files, import project again, download files again, install new version oh the studio...
Someone have some suggestion of how can I save this object?
Edit:
The object is created here:
#Override
public void draw(Canvas canvas) {
List<PoseLandmark> landmarks = pose.getAllPoseLandmarks();
if (landmarks.isEmpty()) {
return;
}
And used in the sequence:
for (PoseLandmark landmark : landmarks) {
drawPoint(canvas, landmark, whitePaint);
if (visualizeZ && rescaleZForVisualization) {
zMin = min(zMin, landmark.getPosition3D().getZ());
zMax = max(zMax, landmark.getPosition3D().getZ());
}
}
Maybe a can workaround.
I want to save an object created by the program with Shared Preferences
Could you provide the code snippet about how you save the object? What object are you trying to save? Are you using the gson library or something similar?
PoseLandmark(int, com.google.mlkit.vision.common.PointF3D, float) is the constructor for PoseLandmark. It is not public. That is probably why you cannot access it.
Currently, you cannot construct a Pose object by yourself. It is not part of the API. To workaround, could you consider extracting the information you need out of Pose and store them in a class you define?
Related
I upgraded my project from:
compileSdkVersion 30
To:
compileSdkVersion 32
and every time i Clean the project i keep getting the error
Failed to create parent directory '/.gradle' when creating directory
the full error is:
Gradle could not start your build.
> Cannot create service of type DefaultConfigurationCache using DefaultConfigurationCache constructor as there is a problem with parameter #10 of type ConfigurationCacheFingerprintController.
> Cannot create service of type ConfigurationCacheFingerprintController using ConfigurationCacheFingerprintController constructor as there is a problem with parameter #5 of type FileCollectionFingerprinterRegistry.
> Cannot create service of type FileCollectionFingerprinterRegistry using method VirtualFileSystemServices$BuildSessionServices.createFileCollectionFingerprinterRegistry() as there is a problem with parameter #1 of type List<FileCollectionFingerprinter>.
> Could not create service of type CrossBuildFileHashCache using BuildSessionServices.createCrossBuildFileHashCache().
> Failed to create parent directory '/.gradle' when creating directory '/.gradle/6.8/fileHashes'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
I tried cleaning the Cash folder in the .gradle folder or renaming the /.gradle/deamon/6.8 folder
but both didn't work
any ideas why it's happening ? or how i can fix it on a mac ?
I am building a gradle java project using sublime, instead of an IDE like eclipse. I have notice when I run the build task, I do not get any warnings about unused imports.
Is there a compiler option in java that can turn on my strict warnings? If so, how do I enable that in my build.gradle?
Thanks.
Warning on unused imports is not something the Java compiler currently handles: https://docs.oracle.com/en/java/javase/14/docs/specs/man/javac.html#examples-of-using--xlint-keys
You can use an external code style tool to take care of that for you. For example, with Spotless
plugins {
`java`
id("com.diffplug.gradle.spotless") version "4.0.0"
}
spotless {
java {
eclipse()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
}
and the following Java source with unused List import:
import java.util.List;
public class Example {
public static void main(String[] args) {
System.out.println("hello");
}
}
when I try to build the project, I will immediately get an error:
> Task :build FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':buildSrc:spotlessJava'.
> The following files had format violations:
src\main\java\io\mateo\gradle\build\Example.java
## -1,7 +1,5 ##
package╖io.mateo.gradle.build;
-import╖java.util.List;
-
public╖class╖Example╖{
\tpublic╖static╖void╖main(String[]╖args)╖{
Run 'gradlew spotlessApply' to fix these violations.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Am new to fastlane, when I write the command for deploy the app to internal test its show me the following error:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:validateSigningRelease'.
Keystore file '/Users/rooh/.gradle/daemon/5.1.1/keystore.jks' not found for signing config 'externalOverride'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
It seems that the error because the location of the keystore, I already put the keystore in app file of the project, I did that in other project and its work fine, but in this I dont know why its not working
I also tried to change the keystore location but still
this lane in fastfile:
desc "Deploy a new internal version to the Google Play Store"
lane :internal do
gradle(task: "clean")
gradle(
task: "assemble",
build_type: "Release",
print_command: false,
properties: {
"android.injected.signing.store.file" => "keystore.jks",
"android.injected.signing.store.password" => "*****",
"android.injected.signing.key.alias" => "alias",
"android.injected.signing.key.password" => "*****"
}
)
changelog = prompt(
text: "Changelog: ",
multi_line_end_keyword: "END"
)
supply(
track: "internal",
apk: lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH].to_s
)
upload_to_play_store(track: "internal")
end
As #Rooh Al-mahaba says, I had to supply the complete filepath as the value for "android.injected.signing.store.file".
Also, ~/ didn't work; I needed to explicitly spell out the full filepath.
INFO: For other users:
You can create several ENV variables, this is useful for CI.
build_android_app(
task: "assemble",
build_type: "Release",
flavor: "development",
flags: "--stacktrace",
print_command: false,
properties:{
"android.injected.signing.store.file" => ENV['KEYSTORE_PATH'],
"android.injected.signing.store.password" => ENV['STORE_PASSWORD'],
"android.injected.signing.key.alias" => ENV['KEY_ALIAS'],
"android.injected.signing.key.password" => ENV['KEY_PASSWORD'],
"org.gradle.java.home" => ENV['JAVA_HOME']
})
Later you need to modify .bash_profile and add the ENV variables.
Flutter + Fastlane + GitHub Actions
I had the same issue and, in my case, I was able to make it work by placing the keystore file in both ./android/fastlane/ and ./android/app/fastlane/ folders.
That is because I had my Fastlane configuration inside the ./android/fastlane/ folder, however, when you run build_android_app / gradle task it will try to fetch the keystore file in the ./android/app/ folder by default, and you cannot tell it to do otherwise unless you use an absolute path (not a good practice) since Fastlane tasks can't parse relative paths. Moreover, if I were to remove the keystore file from the ./android/fastlane/ folder, it would complain, even if it was present in ./android/app/fastlane/.
I am trying to generate the javadoc of a GWT Java project using gradle. When I run the task gradle build, the compilation is successful. However, when I run the gradle javadoc task, it fails with the following error:
C:\Users\jbraga.gradle\caches\modules-2\files-2.1\com.google.gwt\gwt-user\2.8.1\9a13fbee70848f1f1cddd3ae33ad180af3392d9e\gwt-user-2.8.1.jar(com/google/gwt/user/client/ui/Widget.java):28: error: cannot access Event
import com.google.gwt.user.client.Event;
^
bad source file: C:\Users\jbraga.gradle\caches\modules-2\files-2.1\com.google.gwt\gwt-user\2.8.1\9a13fbee70848f1f1cddd3ae33ad180af3392d9e\gwt-user-2.8.1.jar(com/google/gwt/user/client/Event.java)
file does not contain class com.google.gwt.user.client.Event
Please remove or make sure it appears in the correct subdirectory of the sourcepath.
C:\Users\jbraga.gradle\caches\modules-2\files-2.1\com.google.gwt\gwt-user\2.8.1\9a13fbee70848f1f1cddd3ae33ad180af3392d9e\gwt-user-2.8.1.jar(com/google/gwt/layout/client/Layout.java):18: error: cannot find symbol
import static com.google.gwt.dom.client.Style.Unit.PX;
^
symbol: static PX
location: class
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':javadoc'.
Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): 'C:\Users\jbraga\odsoft-18-19-nmb-g302\odsoft\exercise1\component1\students\build\tmp\javadoc\javadoc.options'
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 4s
The GWT version I am using is 2.8.1 and the same occurs with 2.8.2. The gradle.properties file specifies the correct path to the SDK.
Does anyone have a solution to this problem?
Thanks in advance.
This is a known Gradle issue: https://github.com/gradle/gradle/issues/5630, fortunately with a known workaround:
javadoc {
options.addStringOption("sourcepath", "")
}
For me, a slight modification of Thomas Broyer suggested workaround has worked:
javadoc {
options.addStringOption("sourcepath", "")
}
I have been trying to do CI using Jenkins for my Android application. I am new to this. After following some of the tutorials, I am able to atleast set up and run the build now option. It download every pom required but while building it give below error.
============================================
C:\Windows\System32\config\systemprofile.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\e796469c387c11565d873216f24c3b6f\res\drawable\abc_ic_go_search_api_material.xml: error: file not found.
C:\Windows\System32\config\systemprofile.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\7207fbd3bdb6cb696445cfc77c16e5ed\res\drawable-hdpi-v4\googleg_standard_color_18.png: error: file not found.
C:\Windows\System32\config\systemprofile.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\e796469c387c11565d873216f24c3b6f\res\layout\select_dialog_singlechoice_material.xml: error: file not found.
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
======================================================
Can you please let me know how to resolve it?
Do let me know if anything else is required.
Maybe the path is too long. Try this:
Jenkins --> Project --> Project Configuration --> Build
Select advanced option
Check the option box "Force GRADLE_USER_HOME to use workspace"
Build your project
I solved my problem by this way, good luck!
Try updating your android gradle plugin version to 3.2.0-alpha12 or newer. AAPT2's version included in these versions contains many fixes for path support on Windows which resulted in similar errors.
you can solve this by separating into smaller group of task
make separate invoke gradle script under build tab
clean build assembleDebug
test
connectedAndroidTest
i had similar issues, when i ran assembleDebug and test together in Jenkins as a single task
When using Jenkins with Window to build Android, I face this problem myself.
I fix by add GRADLE_USER_HOME to Environment Variable:
GRADLE_USER_HOME = C:\Users\*MyUserName*\.gradle
hope this help,