Closed strk closed 5 years ago
Line 4 is google(), which I think was added by Android Studio not by me. You are probably using an outdated version of the SDK tools. I've got SDK tools 25.2.5, SDK Platform-tools 28.0.1 and SDK Build-tools 28.0.3. also use ./gradlew assembleDebug
or ./gradlew build
or the Android Studio equivalent so that you get the same version of gradle - 4.10.2. A good build looks like this:
-*- mode: compilation; default-directory: "d:/android/Tuner/" -*-
Compilation started at Mon Jan 14 15:08:46
gradlew assembleDebug
> Task :checkDebugClasspath UP-TO-DATE
> Task :preBuild UP-TO-DATE
> Task :preDebugBuild UP-TO-DATE
> Task :compileDebugAidl NO-SOURCE
> Task :compileDebugRenderscript UP-TO-DATE
> Task :checkDebugManifest UP-TO-DATE
> Task :generateDebugBuildConfig
> Task :prepareLintJar UP-TO-DATE
> Task :mainApkListPersistenceDebug UP-TO-DATE
> Task :generateDebugResValues UP-TO-DATE
> Task :generateDebugResources UP-TO-DATE
> Task :mergeDebugResources UP-TO-DATE
> Task :createDebugCompatibleScreenManifests UP-TO-DATE
> Task :processDebugManifest UP-TO-DATE
> Task :splitsDiscoveryTaskDebug UP-TO-DATE
> Task :processDebugResources UP-TO-DATE
> Task :generateDebugSources
> Task :javaPreCompileDebug UP-TO-DATE
> Task :compileDebugJavaWithJavac
> Task :compileDebugNdk NO-SOURCE
> Task :compileDebugSources
> Task :mergeDebugShaders UP-TO-DATE
> Task :compileDebugShaders UP-TO-DATE
> Task :generateDebugAssets UP-TO-DATE
> Task :mergeDebugAssets UP-TO-DATE
> Task :transformClassesWithDexBuilderForDebug
> Task :transformDexArchiveWithExternalLibsDexMergerForDebug
> Task :transformDexArchiveWithDexMergerForDebug
> Task :mergeDebugJniLibFolders UP-TO-DATE
> Task :transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
> Task :transformNativeLibsWithStripDebugSymbolForDebug UP-TO-DATE
> Task :checkDebugLibraries UP-TO-DATE
> Task :processDebugJavaRes NO-SOURCE
> Task :transformResourcesWithMergeJavaResForDebug UP-TO-DATE
> Task :validateSigningDebug UP-TO-DATE
> Task :packageDebug
> Task :assembleDebug
BUILD SUCCESSFUL in 2s
28 actionable tasks: 6 executed, 22 up-to-date
Compilation finished at Mon Jan 14 15:08:50
That's in emacs. An easy mod would be to make the landscape display be just the staff or the staff and the meter. You would need to edit src/main/res/layout-land/activity_main.xml
so it looks like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:ignore="InconsistentLayout">
<!--
<org.billthefarmer.tuner.Display
android:id="@+id/display"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:layout_weight="1.02"
app:BackgroundColour="?android:attr/colorBackground"
app:TextColour="?android:attr/textColorPrimary"
app:lock="?attr/lock" />
-->
<org.billthefarmer.tuner.Staff
android:id="@+id/staff"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:layout_weight="1.02"
app:BackgroundColour="?android:attr/colorBackground"
app:TextColour="?android:attr/textColorPrimary" />
<org.billthefarmer.tuner.Meter
android:id="@+id/meter"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:layout_weight="0.52"
app:BackgroundColour="?android:attr/colorBackground"
app:TextColour="?android:attr/textColorPrimary"
app:screen="?attr/screen" />
<org.billthefarmer.tuner.Status
android:id="@+id/status"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.10"
app:BackgroundColour="?android:attr/colorBackground"
app:TextColour="?android:attr/textColorPrimary" />
</LinearLayout>
Unfortunately doing that introduces a bug, you get a crash because the strobe view isn't present if you touch the staff view. Easily fixed by putting if (strobe != null)
in the onClick()
listener.
Any chance to build w/out the Google SDK ? It sounds wrong that you as the developer are injected code by Google, doesn't it?
Very difficult. A lot of it is open source, but I'm not sure about some of the tools like aapt, or the gradle plugins. AFAIK the SDK compiles the java sources into a jar file using your java compiler, then uses it's tools to convert the jar file and any external libraries into a classes.dex file, compresses some of the the XML files into a resources.arsc file and then packages it all up in an apk file. You can find all the bits in the build
folder, buried deep.
There are two source files that I know of produced by the plugin, BuildConfig.java
and R.java
, which are based on what is in the build.gradle
file and ids you declared in your xml files.
There's an experimental version in the staff branch on here. The landscape orientation shows either the display and the meter or the staff and the meter. Touching the staff locks the display, touching the meter switches between the staff and the display. You lose doing a copy to clipboard in landscape. That's the best compromise I could think of.
Using the ubuntu package for android-sdk:
A problem occurred configuring root project 'tuner'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-28 Android SDK Platform 28
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: /usr/lib/android-sdk
You need to manually install the missing bits using the sdkmanager:
Usage:
sdkmanager [--uninstall] [<common args>] \
[--package_file <package-file>] [<packages>...]
sdkmanager --update [<common args>]
sdkmanager --list [<common args>]
In its first form, installs, or uninstalls, or updates packages.
<package> is a sdk-style path (e.g. "build-tools;23.0.0" or
"platforms;android-23").
<package-file> is a text file where each line is a sdk-style path
of a package to install or uninstall.
Multiple --package_file arguments may be specified in combination
with explicit paths.
In its second form (with --update), currently installed packages are
updated to the latest version.
In its third form, all installed and available packages are printed out.
Common Arguments:
--sdk_root=<sdkRootPath>: Use the specified SDK root instead of the SDK containing this tool
--channel=<channelId>: Include packages in channels up to <channelId>.
Common channels are:
0 (Stable), 1 (Beta), 2 (Dev), and 3 (Canary).
--include_obsolete: With --list, show obsolete packages in the
package listing. With --update, update obsolete
packages as well as non-obsolete.
--no_https: Force all connections to use http rather than https.
--proxy=<http | socks>: Connect via a proxy of the given type.
--proxy_host=<IP or DNS address>: IP or DNS address of the proxy to use.
--proxy_port=<port #>: Proxy port to connect to.
* If the env var REPO_OS_OVERRIDE is set to "windows",
"macosx", or "linux", packages will be downloaded for that OS.
Usage: sdkmanager [--uninstall] [
] \ [--package_file ] [ ...] sdkmanager --update [ ] sdkmanager --list [ ]
Nice, do you know if it is packaged ?
apt-cache search sdkmanager # finds nothing on my Ubuntu 18.04.1 LTS
It's in <wherever your sdk is installed>/tools/bin
. Answer in Stack Overflow. Should have been added to the path when the SDK was installed.
SDK was installed via Ubuntu package, it doesn't look like that contains the sdkmanager :(
This is how Travis-CI does it
$ android-update-sdk --components=tools
Installing tools
spawn android update sdk --no-ui --all --filter tools
And
$ android-update-sdk --components=platform-tools
Installing platform-tools
spawn android update sdk --no-ui --all --filter platform-tools
This is how Travis-CI does it
$ android-update-sdk --components=tools
Installing tools
spawn android update sdk --no-ui --all --filter tools
And
$ android-update-sdk --components=platform-tools
Installing platform-tools
spawn android update sdk --no-ui --all --filter platform-tools
Still there's no android-update-sdk
executable packaged
for an Ubuntu 18.04, that I can find.
Travis is using a plugin for that
Gradle appears to do it for itself, once you get the right version. I'm doing this in Debian installed in Windows. I assumed the android-sdk folder was /usr/lib/android-sdk
. I also copied the android-sdk-license file from the licenses folder in my Windows sdk to /usr/lib/android-sdk/licenses
in Debian. You need to make the android-sdk folder writable so Gradle can write to it.
bill@Cynthia:/mnt/d/android/Tuner$ sudo chmod -R 777 /usr/lib/android-sdk
bill@Cynthia:/mnt/d/android/Tuner$ cp /mnt/d/adt/android-sdk-windows/licenses/android-sdk-license /usr/lib/android-sdk/licenses/
bill@Cynthia:/mnt/d/android/Tuner$ ./gradlew tasks
> Configure project :
Observed package id 'build-tools;24.0.0' in inconsistent location '/usr/lib/android-sdk/build-tools/debian' (Expected '/usr/lib/android-sdk/build-tools/24.0.0')
Already observed package id 'build-tools;24.0.0' in '/usr/lib/android-sdk/build-tools/24.0.0'. Skipping duplicate at '/usr/lib/android-sdk/build-tools/debian'
Observed package id 'build-tools;24.0.0' in inconsistent location '/usr/lib/android-sdk/build-tools/debian' (Expected '/usr/lib/android-sdk/build-tools/24.0.0')
Already observed package id 'build-tools;24.0.0' in '/usr/lib/android-sdk/build-tools/24.0.0'. Skipping duplicate at '/usr/lib/android-sdk/build-tools/debian'
Checking the license for package Android SDK Build-Tools 28.0.3 in /usr/lib/android-sdk/licenses
License for package Android SDK Build-Tools 28.0.3 accepted.
Preparing "Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)".
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" ready.
Installing Android SDK Build-Tools 28.0.3 in /usr/lib/android-sdk/build-tools/28.0.3
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" complete.
"Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)" finished.
Checking the license for package Android SDK Platform 28 in /usr/lib/android-sdk/licenses
License for package Android SDK Platform 28 accepted.
Preparing "Install Android SDK Platform 28 (revision: 6)".
"Install Android SDK Platform 28 (revision: 6)" ready.
Installing Android SDK Platform 28 in /usr/lib/android-sdk/platforms/android-28
"Install Android SDK Platform 28 (revision: 6)" complete.
"Install Android SDK Platform 28 (revision: 6)" finished.
Observed package id 'build-tools;24.0.0' in inconsistent location '/usr/lib/android-sdk/build-tools/debian' (Expected '/usr/lib/android-sdk/build-tools/24.0.0')
Already observed package id 'build-tools;24.0.0' in '/usr/lib/android-sdk/build-tools/24.0.0'. Skipping duplicate at '/usr/lib/android-sdk/build-tools/debian'
> Task :tasks
------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------
Android tasks
-------------
androidDependencies - Displays the Android dependencies of the project.
signingReport - Displays the signing info for the base and test modules
sourceSets - Prints out all the source sets defined in this project.
Build tasks
-----------
assemble - Assemble main outputs for all the variants.
assembleAndroidTest - Assembles all the Test applications.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
bundle - Assemble bundles for all the variants.
clean - Deletes the build directory.
cleanBuildCache - Deletes the build cache directory.
compileDebugAndroidTestSources
compileDebugSources
compileDebugUnitTestSources
compileReleaseSources
compileReleaseUnitTestSources
...
bill@Cynthia:/mnt/d/android/Tuner$ ./gradlew assembleDebug
BUILD SUCCESSFUL in 23s
25 actionable tasks: 24 executed, 1 up-to-date
bill@Cynthia:/mnt/d/android/Tuner$
How you add more licenses I don't know.
If you download the android SDK for Linux you just get the tools folder. If you unzip it to /usr/lib/android-sdk
you can then use it to accept all licenses.
bill@Cynthia:~$ /usr/lib/android-sdk/tools/bin/sdkmanager --licenses
Warning: Observed package id 'build-tools;24.0.0' in inconsistent location '/usr/lib/android-sdk/build-tools/debian' (Expected '/usr/lib/android-sdk/build-tools/24.0.0')
Warning: Already observed package id 'build-tools;24.0.0' in '/usr/lib/android-sdk/build-tools/24.0.0'. Skipping duplicate at '/usr/lib/android-sdk/build-tools/debian'
Warning: Observed package id 'build-tools;24.0.0' in inconsistent location '/usr/lib/android-sdk/build-tools/debian' (Expected '/usr/lib/android-sdk/build-tools/24.0.0')
Warning: Already observed package id 'build-tools;24.0.0' in '/usr/lib/android-sdk/build-tools/24.0.0'. Skipping duplicate at '/usr/lib/android-sdk/build-tools/debian'
Warning: File /home/bill/.android/repositories.cfg could not be loaded.
4 of 5 SDK package licenses not accepted. 100% Computing updates...
Review licenses that have not been accepted (y/N)? y
Not a good idea to do a chmod to make the sdk folder writable, better to do a chown.
bill@Cynthia:~$ sudo apt install android-sdk
bill@Cynthia:~$ sudo chown -R bill:bill /usr/lib/android-sdk/
bill@Cynthia:~$ unzip /mnt/d/Images/android/sdk-tools-linux-4333796.zip -d /usr/lib/android-sdk/
bill@Cynthia:~$ yes | /usr/lib/android-sdk/tools/bin/sdkmanager --licenses
bill@Cynthia:~$ yes | /usr/lib/android-sdk/tools/bin/sdkmanager --update
@billthefarmer I tried building the app on an Ubuntu 18.04.1 LTS distribution, here's what I got: