Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions on how to build? #1

Open
RankoR opened this issue Apr 9, 2021 · 23 comments
Open

Instructions on how to build? #1

RankoR opened this issue Apr 9, 2021 · 23 comments
Assignees

Comments

@RankoR
Copy link

RankoR commented Apr 9, 2021

Hi! Thanks for creating a build, maybe you can publish an instruction how to build it?

@mochadwi
Copy link

mochadwi commented Apr 9, 2021

+1 for this, so we can maybe try to open PR as well if needed.

Thanks for the effort and times to make it this happened!

@VamChao
Copy link

VamChao commented Apr 10, 2021

Thanks!

@dsa28s
Copy link
Owner

dsa28s commented Apr 10, 2021

Oh, I only worked on my macbook, so I couldn't organize it. As soon as I create a build script, and I will push code on the GitHub and update the README. Thank you!!

@dsa28s dsa28s self-assigned this Apr 10, 2021
@andrei-kuznetsov
Copy link

It seems that this repository only contains JBR sources. Is it correct? Note that anyone can download prebuilt JBR from the official jetbrains website.

@dsa28s
Copy link
Owner

dsa28s commented Apr 16, 2021

@andrei-kuznetsov Oh i see. When I first started this project, I just started building from the source. I didn't know there was a good page like this (https://confluence.jetbrains.com/display/JBR/JetBrains+Runtime). Thank you.

And, my work environment has not been cleaned up yet. I modified the Android plugin a little bit, and I'm going to commit this part as soon as it's organized. (README.md too.)

@andrei-kuznetsov
Copy link

I modified the Android plugin a little bit

@dsa28s, Sounds interesting. Google does not publish sources for canary/beta builds. Which sources did you modify?

@RankoR
Copy link
Author

RankoR commented Apr 16, 2021

@andrei-kuznetsov even more, Google's current sources of AS are not even buildable at all as there're no Bazel dependencies included.

@dsa28s
Copy link
Owner

dsa28s commented Apr 17, 2021

@andrei-kuznetsov
As @RankoR said, Google didn't provide the build tool. So I just referred to the Android studio full source.

I extracted the jar file from the original Android Studio and proceeded with the decompilation.
And I modified a little bit by referring to the full source only for the error.

To rebuild a jar file of decompilation, the build was proceeded by provide all jar files to classpath.
So it's difficult to work on it. 😢

@andrei-kuznetsov
Copy link

@dsa28s, understand. Makes sense.

@RankoR, you don't really need these missing bazel dependencies to build android sources.

diff --git a/bazel/common.bazel.rc b/bazel/common.bazel.rc
index 5bba4ae79a..d419f3cba3 100644
--- a/bazel/common.bazel.rc
+++ b/bazel/common.bazel.rc
@@ -95,7 +95,7 @@ build --strategy=CcStrip=standalone
 build --stripopt=--strip-unneeded

 # default android native abis
-build --fat_apk_cpu=x86,x86_64,armeabi-v7a,armeabi,arm64-v8a
+build --fat_apk_cpu=x86,x86_64,armeabi-v7a,arm64-v8a

 build:remote --config=remote_common
 build:remote --nobuild_runfile_links
diff --git a/bazel/toplevel.WORKSPACE b/bazel/toplevel.WORKSPACE
index e00f772c91..45f0303746 100644
--- a/bazel/toplevel.WORKSPACE
+++ b/bazel/toplevel.WORKSPACE
@@ -4,15 +4,6 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

 setup_external_repositories()

-local_repository(
-    name = "blaze",
-    path = "tools/vendor/google3/blaze",
-)
-
-load("@blaze//:binds.bzl", "blaze_binds")
-
-blaze_binds()
-
 local_repository(
     name = "io_bazel_rules_kotlin",
     path = "tools/external/bazelbuild-rules-kotlin",
diff --git a/build-system/integration-test/integration-tests.gradle b/build-system/integration-test/integration-tests.gradle
index a399a797eb..22586428ec 100644
--- a/build-system/integration-test/integration-tests.gradle
+++ b/build-system/integration-test/integration-tests.gradle
@@ -72,7 +72,7 @@ test {
     // Always run the task, when requested.
     outputs.upToDateWhen { false }

-    maxParallelForks = Runtime.runtime.availableProcessors() / 4
+    maxParallelForks = Math.max(1, (int) (Runtime.runtime.availableProcessors() / 4))

     useJUnit {
         if (System.properties['test.includeCategories'] != null) {

Of course, you'll also need to setup Android SDK and NDK

curl https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip > /aosp/sdk-tools-linux.zip && \
    unzip /aosp/sdk-tools-linux.zip -d /aosp/sdk && \
    /aosp/sdk/tools/bin/sdkmanager "platform-tools" "ndk;20.0.5594570" "platforms;android-29" "build-tools;26.0.0" && \
    ln -s /aosp/sdk/ndk/20.0.5594570 /aosp/sdk/ndk-bundle

ln -s /aosp/sdk ${SRC}/prebuilts/studio/sdk/linux

And fix missing jvmti.h header.

mkdir -p ${SRC}/tools/vendor/google/android-ndk/includes
cp ${PATCHES}/tools.vendor.google.android-ndk.BUILD ${SRC}/tools/vendor/google/android-ndk/BUILD
curl https://android.googlesource.com/platform/art/+/master/openjdkjvmti/include/jvmti.h?format=TEXT | base64 -d > ${SRC}/tools/vendor/google/android-ndk/includes/jvmti.h
# tools.vendor.google.android-ndk.BUILD
package(default_visibility = ["//visibility:public"])

cc_library(
    name = "jvmti",
    includes = ["includes"],
)

I'm not sure why one might want to build studio from sources: there will be missing (closed-sources) parts like c/c++ dev, firebase plugin and the like. If you think that it helps, I can share docker file that builds full environment capable to build Android Studio 4.1.1 from sources (including native agents that are deployed to the device itself). But I don't see the point (unless you are developing some custom IDE on the top of Android Studio).

@dan10
Copy link

dan10 commented Apr 23, 2021

I modified the Android plugin a little bit

@dsa28s, Sounds interesting. Google does not publish sources for canary/beta builds. Which sources did you modify?

The branch mirror-goog-studio-master-dev in aosp seem to be adding code related to M1, so i think is appointing to canary build

@dan10
Copy link

dan10 commented Apr 23, 2021

@dsa28s, understand. Makes sense.

@RankoR, you don't really need these missing bazel dependencies to build android sources.

diff --git a/bazel/common.bazel.rc b/bazel/common.bazel.rc
index 5bba4ae79a..d419f3cba3 100644
--- a/bazel/common.bazel.rc
+++ b/bazel/common.bazel.rc
@@ -95,7 +95,7 @@ build --strategy=CcStrip=standalone
 build --stripopt=--strip-unneeded

 # default android native abis
-build --fat_apk_cpu=x86,x86_64,armeabi-v7a,armeabi,arm64-v8a
+build --fat_apk_cpu=x86,x86_64,armeabi-v7a,arm64-v8a

 build:remote --config=remote_common
 build:remote --nobuild_runfile_links
diff --git a/bazel/toplevel.WORKSPACE b/bazel/toplevel.WORKSPACE
index e00f772c91..45f0303746 100644
--- a/bazel/toplevel.WORKSPACE
+++ b/bazel/toplevel.WORKSPACE
@@ -4,15 +4,6 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

 setup_external_repositories()

-local_repository(
-    name = "blaze",
-    path = "tools/vendor/google3/blaze",
-)
-
-load("@blaze//:binds.bzl", "blaze_binds")
-
-blaze_binds()
-
 local_repository(
     name = "io_bazel_rules_kotlin",
     path = "tools/external/bazelbuild-rules-kotlin",
diff --git a/build-system/integration-test/integration-tests.gradle b/build-system/integration-test/integration-tests.gradle
index a399a797eb..22586428ec 100644
--- a/build-system/integration-test/integration-tests.gradle
+++ b/build-system/integration-test/integration-tests.gradle
@@ -72,7 +72,7 @@ test {
     // Always run the task, when requested.
     outputs.upToDateWhen { false }

-    maxParallelForks = Runtime.runtime.availableProcessors() / 4
+    maxParallelForks = Math.max(1, (int) (Runtime.runtime.availableProcessors() / 4))

     useJUnit {
         if (System.properties['test.includeCategories'] != null) {

Of course, you'll also need to setup Android SDK and NDK

curl https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip > /aosp/sdk-tools-linux.zip && \
    unzip /aosp/sdk-tools-linux.zip -d /aosp/sdk && \
    /aosp/sdk/tools/bin/sdkmanager "platform-tools" "ndk;20.0.5594570" "platforms;android-29" "build-tools;26.0.0" && \
    ln -s /aosp/sdk/ndk/20.0.5594570 /aosp/sdk/ndk-bundle

ln -s /aosp/sdk ${SRC}/prebuilts/studio/sdk/linux

And fix missing jvmti.h header.

mkdir -p ${SRC}/tools/vendor/google/android-ndk/includes
cp ${PATCHES}/tools.vendor.google.android-ndk.BUILD ${SRC}/tools/vendor/google/android-ndk/BUILD
curl https://android.googlesource.com/platform/art/+/master/openjdkjvmti/include/jvmti.h?format=TEXT | base64 -d > ${SRC}/tools/vendor/google/android-ndk/includes/jvmti.h
# tools.vendor.google.android-ndk.BUILD
package(default_visibility = ["//visibility:public"])

cc_library(
    name = "jvmti",
    includes = ["includes"],
)

I'm not sure why one might want to build studio from sources: there will be missing (closed-sources) parts like c/c++ dev, firebase plugin and the like. If you think that it helps, I can share docker file that builds full environment capable to build Android Studio 4.1.1 from sources (including native agents that are deployed to the device itself). But I don't see the point (unless you are developing some custom IDE on the top of Android Studio).

can you provide the docker file please?

@mochadwi
Copy link

https://androidstudio.googleblog.com/2021/04/android-studio-arctic-fox-canary-15.html#:~:text=apple%20silicon%20support%20

@VamChao
Copy link

VamChao commented Apr 30, 2021

@VamChao
Copy link

VamChao commented Apr 30, 2021

I can't find download link for Apple Silicon.

@palvajk
Copy link

palvajk commented Apr 30, 2021

this is universal build its run on Intel and Apple Silicon natively. But this link contains separate packages https://developer.android.com/studio/archive

@VamChao
Copy link

VamChao commented Apr 30, 2021

image
image

@VamChao
Copy link

VamChao commented Apr 30, 2021

image

@palvajk
Copy link

palvajk commented Apr 30, 2021

Képernyőfotó 2021-04-30 - 8 40 45

You can find ARM build here: https://developer.android.com/studio/archive

@VamChao
Copy link

VamChao commented Apr 30, 2021

Thank you! But...
image
Can you send me the. Zip link?

@VamChao
Copy link

VamChao commented Apr 30, 2021

Thank you very much ! I downloaded it successfully. Yeah~

@andrei-kuznetsov
Copy link

@dan10

can you provide the docker file please?

https://github.com/andrei-kuznetsov/android-studio-builder/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants