AndroidのMidiDriverをBuildしてみた
https://github.com/KyoSherlock/MidiDriver
// まずはterminalでbuild
$ ./gradlew
// this error occurs
// * What went wrong:
// Could not determine java version from '11.0.11'.
// then, this error occurs
// Gradle version 2.2 is required. Current version is 7.5. If using the gradle wrapper, try editing the distributionUrl in /Users/{your_user_name}/.gradle/daemon/7.5/gradle/wrapper/gradle-wrapper.properties to gradle-2.2-all.zip
// tried editing distributionUrl in gradle/wrapper/gradle-wrapper.properties
// distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
// and click "Try Again"
// then, this shows
// This version of Android Studio requires projects to use Gradle 4.8.1 or newer. This project is using Gradle 2.2.
Change to minimum versions (plugin 3.2.0, Gradle 4.8.1) and sync project
Change to latest versions (plugin 7.1.2, Gradle 7.2) and sync project
Open build file
// I chose "Change to minimum versions and sync project"
// and it works!
その後、./gradlew buildを実行すると、下記エラーメッセージ
> Task :sample:checkDebugClasspath FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':sample:debugCompileClasspath'.
> Could not find com.android.support:appcompat-v7:23.1.1.
Searched in the following locations:
- file:/Users/{username}/Library/Android/sdk/extras/m2repository/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.pom
- file:/Users/{username}/Library/Android/sdk/extras/m2repository/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.jar
- file:/Users/{username}/Library/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.pom
- file:/Users/{username}/Library/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.jar
- file:/Users/{username}/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.pom
- file:/Users/{username}/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.jar
- https://jcenter.bintray.com/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.pom
- https://jcenter.bintray.com/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.jar
Required by:
project :sample
> Could not find com.android.support:design:23.1.1.
Searched in the following locations:
- file:/Users/{username}/Library/Android/sdk/extras/m2repository/com/android/support/design/23.1.1/design-23.1.1.pom
- file:/Users/{username}/Library/Android/sdk/extras/m2repository/com/android/support/design/23.1.1/design-23.1.1.jar
- file:/Users/{username}/Library/Android/sdk/extras/google/m2repository/com/android/support/design/23.1.1/design-23.1.1.pom
- file:/Users/{username}/Library/Android/sdk/extras/google/m2repository/com/android/support/design/23.1.1/design-23.1.1.jar
- file:/Users/{username}/Library/Android/sdk/extras/android/m2repository/com/android/support/design/23.1.1/design-23.1.1.pom
- file:/Users/{username}/Library/Android/sdk/extras/android/m2repository/com/android/support/design/23.1.1/design-23.1.1.jar
- https://jcenter.bintray.com/com/android/support/design/23.1.1/design-23.1.1.pom
- https://jcenter.bintray.com/com/android/support/design/23.1.1/design-23.1.1.jar
Required by:
project :sample
> Could not find com.android.support:support-v4:23.1.1.
Searched in the following locations:
- file:/Users/{username}/Library/Android/sdk/extras/m2repository/com/android/support/support-v4/23.1.1/support-v4-23.1.1.pom
- file:/Users/{username}/Library/Android/sdk/extras/m2repository/com/android/support/support-v4/23.1.1/support-v4-23.1.1.jar
- file:/Users/{username}/Library/Android/sdk/extras/google/m2repository/com/android/support/support-v4/23.1.1/support-v4-23.1.1.pom
- file:/Users/{username}/Library/Android/sdk/extras/google/m2repository/com/android/support/support-v4/23.1.1/support-v4-23.1.1.jar
- file:/Users/{username}/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.1.1/support-v4-23.1.1.pom
- file:/Users/{username}/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.1.1/support-v4-23.1.1.jar
- https://jcenter.bintray.com/com/android/support/support-v4/23.1.1/support-v4-23.1.1.pom
- https://jcenter.bintray.com/com/android/support/support-v4/23.1.1/support-v4-23.1.1.jar
Required by:
project :sample > project :sherlockmidi
* 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 3s
1 actionable task: 1 executed
StackOverflowにこんな情報がありました。
https://stackoverflow.com/questions/64286734/could-not-find-com-android-supportappcompat-v723-1-1
https://stackoverflow.com/questions/46467561/difference-between-google-and-maven-url-https-maven-google-com
つまり、google()はGradle4.x+から登場したmaven{ url ‘https://maven.google.com’ }のショートカットで、それより古いGradleを使う場合はmavenと記載しないといけないということのようです。
// build.gradle
buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
./gradlew buildでbuildされたarrファイルをlibs dir下にペースト
// build.gradle
dependencies {
implementation files('libs/sherlockmidi-release.aar')
}