How to get tools/source.properties on Android SDK (in Travis)? - java

I'm trying to build javaocr on Travis and the com.simpligility.maven.plugins:android-maven-plugin:4.1.1 Maven plugin wants to read tools/source.properties in the Android SDK root. How can I provide this file? I cannot install the complete SDK since it will exceed the space limitation of the Travis CI service, but I'm sure there's a specific component which needs to be installed.
I have no idea about the Android API version or whatever is needed, but I'll figure it out if necessary. My current motivation is to verify the complete project on Travis after I made changes to it.

It's not a travis-ci issue, I reproduced and solved it locally.
Error reading
/home/travis/build/krichter722/javaocr/demos/sampler/android-studio/tools/source.properties
The path is not correct, use TRAVIS_BUILD_DIRenv variable or absolute paths.
As suggested here, move your resources and manifests to the new location.
android-maven-plugin-4.0 uses the new Android Studio folder layout
which is much more Mavenish. Ie Android resources should be is
src\main\res, Android assets in src\main\assets, AndroidManifest.xml
in src\main
Install only the necessary components by name or number but never the full SDK.
./android-sdk-linux/tools/android update sdk -a -u -t tools,platform-tools,build-tools-23.0.3,android-23
I did a phew changes to your pom.xml files based on this response and this manual
You need to replace the plugin with groupId
"com.jayway.maven.plugins.android.generation2" with
"com.simpligility.maven.plugins" due to a compatibility issue.
So the new plugin is:
com.simpligility.maven.plugins
android-maven-plugin 4.1.1
21
true
true
true

Related

java.io.IOException: Can't read. In unity when I try to build my game

I have a problem when I try to build my game it shows me this error: java.io.IOException: Can't read
[C:\Users\niksr\OneDrive\Documents\Unity\2021.3.8f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-33\optional\android.car.jar] (Can't process class [android/car/Car$CarServiceLifecycleListener.class] (Unsupported version number [55.0] (maximum 54.0, Java 10))) See the Console for Details.
Before this, I was able to build my game. I was really close to publish it on play store, but it said "Your app currently targets API level 30 and must target at least API level 31 to ensure it is built on the latest APIs optimized for security and performance. Change your app's target API level to at least 31.". I changed it to 33, but then I tried to build my game and this error showed up. After that, I changed it back to the original API level, but this error still showed up.
I don't know why this error persists, but please help me solve this problem.
I had the same issue. Reverting back to API 32 solved the issue and had no feedback from google.
In case you still have the issue try installing API 32 with the commandline(first remove the folder in the platforms folder).
I installed API 32 with commandline with the sdk manager.
go to where the sdk is installed in your case:
C:\Users\niksr\OneDrive\Documents\Unity\2021.3.8f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK
Then run:
./cmdline-tools/2.1/bin/sdkmanager "platforms;android-32"
I was able to get rid of it by enabling 'Use R8' but then Google Play won't accept my ReTrace mapping file.
Another option is to build it with Andriod Studio.
Install Android Studio with api 33.
set api 33 in the player settings at the project.
Then at build settings select export project.
BuildSettings
Open de exported folder in android studio.
Find a error about the code line
enableR8=false
Delete that line as it is outdated.
And follow the appropriate build steps for you.

bazel build error - tensor flow

I am struggling to put my model in the Android studio.
In order to use my model in the Android studio, I also know that I need to put the libandroid_tensorflow_inference_java.jar and libtensorflow_inference.so files into the assets folder in Android Studio.
So I used git to download the tensorflow library and use it to build .so and .jar files.
During the creation of the .so file I faced a problem that I could not solve.
I installed the SDK in the Android studio according to the procedure, and since I currently only support NDK version 17 in the studio, I installed version 12 externally and unzipped it.
~/tensorflow/WORKSPACE
In order to build a bazel, I modified the content of WORKSPACE in the root folder of tensorflow as shown above. this
But I had to face these terrible errors.
this this
To solve this problem, I changed the NDK location and installed another version of NDK. I tried to take other actions but the error did not go away. I have been working from yesterday to solve this problem. I need your help.
It looks like you're missing the -std=c++11 flag.
Try passing this additional Bazel flag: --cxxopt=-std=c++11.

How to Setup gradle-2.2.1-all.zip Manually

I want to run my unit test with this command
gradlew.bat connectedInstrumentTest
But it tries to download https://services.gradle.org/distributions/gradle-2.2.1-all.zip
And my corporal network blocks it. Hence, I want to setup the zip manually, I already downloaded it from browser.
The ways I failed are listed below
Pasting it in Program Files\Android\Android Studio\gradle\
gradle-2.2.1 didn't work
File -> Settings -> Build execution, Deployment -> Build Tools and
defining the gradle home directory didn't work
Any suggestions except these will be much appreciated. Thanks.
Solution :
1). Delete the C:\Users\username\.gradle folder
2). Download http://downloads.gradle.org/distributions/gradle-2.2.1-all.zip
3). Create a new project in android studio.
4). When this time it stucks at gradle building, Force close the android studio.
5) Now go to C:\Users\username\.gradle\wrapper\dists\gradle-2.2.1-all\c64ydeuardnfqctvr1gm30w53 (the end directory name may be different)
6) Delete gradle-2.2.1-all.zip.lck and other files from this directory.
7) Paste the new downloaded gradle-2.2.1-all.zip here.
8) Run the android studio. :)
In your command you're using the Gradle Wrapper. The Gradle wrapper is a thin wrapper around the real Gradle bin. It's intended to be checked in to your source control and it then downloads the version of Gradle you've defined in gradle/wrapper/gradle-wrapper.properties. The advantage here is the version of Gradle used in the build is directly tied to the source control.
You have 2 options:
use the gradle command instead of gradlew - this will use the gradle that's installed on the local machine (assumes that 'gradle' is on the PATH). The drawback here is you have to have installed Gradle somewhere before the build will work.
change distributionUrl in gradle/wrapper/gradle-wrapper.properties to point to a different URL and host that file yourself somewhere. You get all the advantages of the wrapper but fix the problems you're having downloading it.
Mostly, this error occurs due to brake in internet or slow connection network.
A gradle file downloads partially, this zip file isn't extractable and neither does re-download using Android Studio work.
So, to solve this problem, you have to:
Delete the gradle download folder or download the gradle zip file manually and configure using the following method
Download requires gradle and past the zip into C:\Users\your_pc_name\.gradle\wrapper\dists
Finally, open Android Studio and run the project.
The gradle version care fully before downloading

R.java never appears

When I work on an android application in Eclipse, R.java never appears. I did the following to try to fix it:
delete ~/.eclipse folder
reinstall eclipse
create a new workspace
reinstall android developer tools
reinstall operating system
None of it worked. Even the Hello World! application that is created by default won't build. What do I have left I can do?
UPDATE:
There aren't any problems in Problems other than the two "R cannot be resolved to a variable"s. The Error Log tab shows an error Failed to load properties file for project from when I created the project. I think that may be a good clue as to what the root issue is.
ANOTHER UPDATE:
It's not a permissions issue, since the same thing happens when I run Eclipse as root. 'Fix Project Properties' does nothing. When I comment out the references to R.java, the problem is not resolved (the reason it doesn't run is [2013-07-08 21:47:37 - AppName] Could not find AppName.apk!
)
YET ANOTHER UPDATE:
running eclipse as root works now.
OS is 64-bit Arch Linux
Make sure that you have no xml related error( open and check all xml files, including the manifest manually).
Clean your project.
Change the build target version.
Make sure that you have Android SDK build tools. It comes on updating the ADT plugin.
Try these things:
Check in the properties of the project, in the Android tab if you have downloaded the version of the API that you are using. (See this in the SDK Manager)
Look into your /res folder. Scan for every file. Does any one has problems? If one resource has a problem, the R.java file is not generated.
Check the AndroidManifest.xml file. Look for warnings or problems, especially the use of the <uses-sdk> tag.
If none of these appointed the problem, try to build a simple java application. Does it work? Are you using the JDK 1.6?
Finally, if you are still stuck, download the Android ADT and use it as your IDE. It has all you need.
If your O/S is 64-bit Linux you will encounter Problems with the ADT because it is a 32-bit application. You have to install the following 32-bit libraries:
sudo apt-get install ia32-libs

What happened to Android AAPT?

I downloaded the most recent version of Android for Linux (android-sdk_r05-linux_86.tgz). I was trying to use the the Android Ant task(s) for packaging, building, and deploying my code. I should mention that I'm running AMD64, but I have the 32-bit libraries installed. The Android Ant tasks are all broken.
First, the start-emulator task never gets the emulator running. It does get past starting adb, but then it just sits there.
Second, the SDK is missing the AAPT binary in the tools directory. So, the example notepad sample application will not even package correctly.
java.lang.IllegalStateException: Can't find aapt inside the sdk at /home/user/bin/android-sdk-linux_86
at com.googlecode.autoandroid.lib.AndroidTools.locateTool(AndroidTools.java:116)
at com.googlecode.autoandroid.lib.AndroidTools.startTool(AndroidTools.java:103)
at com.googlecode.autoandroid.lib.AndroidTools.startTool(AndroidTools.java:91)
at com.googlecode.autoandroid.lib.UnixAndroidTools.aapt(UnixAndroidTools.java:9)
I have all the dependencies configured for Android. I can run it from the command line just fine.
I assume the Ant code is out of sync with the recent SDK updates. Can anyone shed some light on this problem? At this point, I'm considering writing my own Python scripts to interact with the Android SDK. Ugh.
For anyone running into this recently, aapt moved again. It's now in $ANDROID_SDK/build-tools/17.0.0.
I have written three books all using the Android Ant build scripts. Trust me, they work.
First, the start-emulator task never
gets the emulator running. It does get
past starting adb, but then just sits
there.
Run the android command and launch the emulator from AVD Manager window that appears. AFAIK, there is no start-emulator task in Ant -- in fact, I'm not aware that there ever has been one.
Second, the SDK is missing the aapt
binary in the tools directory.
If you are looking in $ANDROID_HOME/tools/ (where $ANDROID_HOME is where you unpacked the SDK), you aren't supposed to find aapt there. That directory is for tools that directly support all API levels. API-level-specific tools, like aapt, will reside in $ANDROID_HOME/platforms/$SDK/tools/ (where $SDK is the name of some Android version, like android-2.1).
If you do not have anything in $ANDROID_HOME/platforms/, please follow step 4 of the installation instructions.

Categories