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

Build FIX AGP 8 API 33 #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
### Requirements
1. Android Studio Bumblebee (2021.1.1) - via [Android Developers](https://developer.android.com/studio)
2. Android SDK 31 and BuildTools 30.0.3 - via [Android SDK Manager](https://developer.android.com/studio/intro/update#sdk-manager)
3. Java JDK 11 - via [Azul OpenJDK](https://www.azul.com/downloads/?version=java-11-lts&package=jdk) or [Oracle Java Downloads](https://www.oracle.com/java/technologies/javase/jdk11-archive-downloads.html)
4. npm - via [Node.js installer](https://nodejs.org/en/download/) or [nvm](https://github.com/nvm-sh/nvm#install--update-script)

### Setup nvm
1. Open terminal
2. Execute `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash`
3. Execute `nvm install 16`
4. Execute `nvm use 16`
5. Execute `npm install -g mountebank`
6. Execute `npm install -g [email protected]`
7. Execute `npm audit fix`

### Setup the project
1. Locate the current directory in terminal
2. Execute `mb --configfile imposters.ejs`
3. Open `build.gradle` in the current directory
4. Run the project and make sure the app can start correctly(don't worry about if the features are working properly)
1. [Android Studio Latest Stable](https://developer.android.com/studio)
2. [SDK 33 and BuildTools 32.0.2](https://developer.android.com/studio/intro/update#sdk-manager)
3. [JDK 11](https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html)
4. [Node.js installer](https://nodejs.org/en/download/)
5. [nvm](https://github.com/nvm-sh/nvm#install--update-script)

### Setup
```shell
./test_server.sh
```

Run the project and make sure the app can start correctly(don't worry about if the features are working properly)

### App Introduction

Expand Down
36 changes: 36 additions & 0 deletions adb_screen_copy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
scrcpy --turn-screen-off --show-touches


# ADB Screen Copy
#
## Scrcpy
#Pronounced as "screen copy," allows you to mirror the screen of an Android device on your computer and control it using your keyboard and mouse. It is a free and open-source software developed by Genymobile.
#
#Scrcpy offers several features and benefits, including:
#
#- **Lightness**: It is a native application that only displays the device screen, ensuring a lightweight performance.
#- **Performance**: Scrcpy achieves a high frame rate ranging from 30 to 120fps, depending on the connected device.
#- **Quality**: The mirrored screen has a resolution of 1920x1080 or higher, ensuring a high-quality display.
#- **Low latency**: Scrcpy provides low latency between the device and the computer, typically ranging from 35 to 70ms.
#- **Low startup time**: It takes approximately one second to display the first image after launching the application.
#- **Non-intrusiveness**: Scrcpy does not leave any installation traces on the Android device.
#- **User benefits**: The application does not require user accounts, displays no ads, and does not need an internet connection.
#- **Freedom**: Scrcpy is free and open-source software, allowing users to modify and customize it according to their needs.
#
#To use scrcpy, you need to install it on your computer and connect your Android device via USB or over TCP/IP. Once connected, you can control your Android device's screen using your computer's keyboard and mouse.
#
#Scrcpy supports multiple operating systems, including Linux, Windows, and macOS. It offers additional features such as audio forwarding (available on Android devices running Android 11 or later) and support for video codecs like H265 and AV1.
#
#If you're interested in downloading scrcpy or learning more about its usage, you can visit the following resources:
#
#1. [GitHub repository for scrcpy](https://github.com/Genymobile/scrcpy) [[🔗](https://github.com/Genymobile/scrcpy)]
#2. [Official website for scrcpy](https://scrcpy.org/) (Note: The website seems to be unreachable at the moment.)
#
#You can also refer to tutorials and guides available on various platforms, such as:
#
#- [Tom's Hardware guide on controlling Android devices using scrcpy](https://www.tomshardware.com/how-to/control-android-device-from-pc-using-scrcpy) [[🔗](https://www.tomshardware.com/how-to/control-android-device-from-pc-using-scrcpy)]
#- [Wikipedia page on scrcpy](https://en.wikipedia.org/wiki/Scrcpy) [[🔗](https://en.wikipedia.org/wiki/Scrcpy)]
#- [XDA Developers article on scrcpy and its features](https://www.xda-developers.com/free-android-mirroring-app-scrcpy-seamless-copy-paste-stay-awake/) [[🔗](https://www.xda-developers.com/free-android-mirroring-app-scrcpy-seamless-copy-paste-stay-awake/)]
#- [GeeksforGeeks tutorial on mirroring Android screen to PC using scrcpy](https://www.geeksforgeeks.org/mirror-android-screen-to-pc-using-scrcpy/) [[🔗](https://www.geeksforgeeks.org/mirror-android-screen-to-pc-using-scrcpy/)]
#- [Softonic page for downloading scrcpy](https://scrcpy.en.softonic.com/) [[🔗](https://scrcpy.en.softonic.com/)]
#- [Tecmint guide on using scrcpy to control Android devices via Linux desktop](https://www.tecmint.com/scrcpy-connect-android-linux/) [[🔗](https://www.tecmint.com/scrcpy-connect-android-linux/)]
108 changes: 59 additions & 49 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,70 +1,80 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
plugins {
id 'com.android.application' // 🧩 Plugin for Android application
id 'kotlin-android' // 🧩 Plugin for Kotlin Android support
}

android {
compileSdkVersion 31
namespace 'com.tws.moments' // 🏷️ Namespace for your application

compileSdkVersion 33 // 🎯 Set the compile SDK version to 33

defaultConfig {
applicationId "com.tws.moments"
minSdkVersion 20
targetSdkVersion 31
versionCode 1
versionName "1.0"
applicationId "com.tws.moments" // 📝 Application ID for your app
minSdkVersion 20 // 📈 Minimum supported SDK version
targetSdkVersion 33 // 🎯 Target SDK version for your app
versionCode 1 // 🆕 Version code for your app
versionName "1.0" // 🆕 Version name for your app

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" // 🏃‍♂️ Test runner for instrumentation tests
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11 // 🔧 Source compatibility for Java 11
targetCompatibility JavaVersion.VERSION_11 // 🔧 Target compatibility for Java 11
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
minifyEnabled false // ❌ Disable code minification for release build
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' // 🗡️ Proguard files for release build
}
}
// work-runtime-ktx 2.1.0 and above now requires Java 8

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "11" // 🔧 Set the JVM target version to 11 for Kotlin
}

buildFeatures {
viewBinding true
viewBinding true // 📚 Enable view binding support
}

testOptions {
unitTests.includeAndroidResources = true
unitTests.includeAndroidResources = true // ✅ Include Android resources for unit tests
}
buildToolsVersion '30.0.3'

buildToolsVersion '33.0.2' // 🔧 Build tools version for your app
}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

implementation 'com.github.bumptech.glide:glide:4.12.0'

implementation "androidx.fragment:fragment-ktx:1.4.1"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1"

implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'

implementation 'com.google.code.gson:gson:2.9.0'
implementation 'androidx.test.ext:junit-ktx:1.1.3'

testImplementation 'junit:junit:4.13.2'
testImplementation 'androidx.test:core:1.4.0'
testImplementation 'org.mockito:mockito-core:4.2.0'
testImplementation 'io.mockk:mockk:1.12.2'
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0'
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.1'
testImplementation 'androidx.arch.core:core-testing:2.1.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
// Dependencies remain the same as before
implementation fileTree(dir: "libs", include: ["*.jar"]) // 📚 Include JAR files from the "libs" directory
implementation 'androidx.core:core-ktx:1.10.1' // 📚 AndroidX Core KTX library
implementation 'androidx.appcompat:appcompat:1.6.1' // 📚 AndroidX AppCompat library
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' // 📚 AndroidX ConstraintLayout library
implementation 'androidx.recyclerview:recyclerview:1.3.0' // 📚 AndroidX RecyclerView library
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' // 📚 AndroidX SwipeRefreshLayout library

implementation 'com.github.bumptech.glide:glide:4.15.1' // 📚 Glide image loading library

implementation 'androidx.fragment:fragment-ktx:1.6.0' // 📚 AndroidX Fragment KTX library
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0" // 📚 AndroidX Lifecycle Extensions library
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1' // 📚 AndroidX LiveData KTX library
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1' // 📚 AndroidX ViewModel KTX library

implementation 'com.squareup.retrofit2:retrofit:2.9.0' // 📚 Retrofit HTTP client library
implementation 'com.squareup.retrofit2:converter-gson:2.9.0' // 📚 Gson converter for Retrofit
implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2' // 📚 Kotlin Coroutines adapter for Retrofit

implementation 'com.google.code.gson:gson:2.10.1' // 📚 Gson library for JSON parsing
implementation 'androidx.test.ext:junit-ktx:1.1.5' // 📚 AndroidX JUnit KTX library

testImplementation 'junit:junit:4.13.2' // 📚 JUnit library for unit tests
testImplementation 'androidx.test:core:1.5.0' // 📚 AndroidX Test Core library
testImplementation 'org.mockito:mockito-core:5.3.1' // 📚 Mockito library for mocking objects in tests
testImplementation 'io.mockk:mockk:1.13.5' // 📚 MockK library for mocking objects in tests
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1' // 📚 Kotlin Coroutines core library for tests
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1' // 📚 Kotlin Coroutines test library for tests
testImplementation 'androidx.arch.core:core-testing:2.2.0' // 📚 AndroidX Core Testing library
androidTestImplementation 'androidx.test.ext:junit:1.1.5' // 📚 AndroidX JUnit library for instrumentation tests
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' // 📚 Espresso UI testing library
}
25 changes: 12 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.6.20"
ext {
kotlin_version = "1.8.21" // 🔧 Kotlin version
gradle_plugin_version = "8.0.0" // 🔧 Gradle plugin version
}
repositories {
google()
mavenCentral()
google() // 🌐 Google Maven repository
mavenCentral() // 🌐 Maven Central repository
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "com.android.tools.build:gradle:$gradle_plugin_version" // 🧩 Android Gradle plugin
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // 🧩 Kotlin Gradle plugin
}
}

allprojects {
repositories {
google()
mavenCentral()
google() // 🌐 Google Maven repository
mavenCentral() // 🌐 Maven Central repository
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
delete rootProject.buildDir // 🗑️ Clean task to delete the build directory
}
25 changes: 24 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html


# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m


# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand All @@ -15,7 +19,26 @@ org.gradle.jvmargs=-Xmx2048m
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true


# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true


# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
kotlin.code.style=official


#The line org.gradle.unsafe.configuration-cache=true enables the experimental configuration cache
# feature in Gradle. This feature allows Gradle to cache configuration calculations, which can
# improve build performance by avoiding redundant calculations during subsequent builds.
#
#It's important to note that the configuration cache feature is marked as "unsafe" because it is
# still under development and may have limitations or potential issues. Therefore, it should be
# used with caution, especially in production or critical environments.
#
#Enabling this feature can be beneficial for large projects with complex build configurations,
# as it reduces the time spent on configuration calculations. It's recommended to thoroughly test
# the build with the configuration cache enabled to ensure compatibility and stability.
org.gradle.unsafe.configuration-cache=true

22 changes: 16 additions & 6 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#Thu Dez 09 19:10:09 UTC-3 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
# Last modified Wed Jun 07 18:52:49 BRT 2023

## Base directory where Gradle distributions are stored for the user.
distributionBase=GRADLE_USER_HOME

## Relative path where Gradle distributions are stored within the project.
distributionPath=wrapper/dists

## Base directory where downloaded Gradle distributions are stored for the user.
zipStoreBase=GRADLE_USER_HOME

## Relative path where downloaded Gradle distributions are stored within the project.
zipStorePath=wrapper/dists

## URL for downloading Gradle distributions.
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
6 changes: 6 additions & 0 deletions mb1.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{"level":"info","message":"[mb:2525] mountebank v2.8.2 now taking orders - point your browser to http://localhost:2525/ for help","timestamp":"2023-06-07T20:40:39.141Z"}
{"level":"info","message":"[mb:2525] PUT /imposters","timestamp":"2023-06-07T20:40:39.660Z"}
{"level":"info","message":"[http:2727 User] Open for business...","timestamp":"2023-06-07T20:40:39.709Z"}
{"level":"info","message":"[http:2727 User] ::ffff:127.0.0.1:49960 => GET /user/jsmith","timestamp":"2023-06-07T21:24:30.859Z"}
{"level":"info","message":"[http:2727 User] ::ffff:127.0.0.1:49972 => GET /user/jsmith/tweets","timestamp":"2023-06-07T21:24:30.926Z"}
{"level":"info","message":"[http:2727 User] ::ffff:127.0.0.1:38544 => GET /user/jsmith/tweets","timestamp":"2023-06-07T21:26:40.216Z"}
59 changes: 59 additions & 0 deletions test_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

# Function to install nvm and Node.js 📦🌟
install_nvm() {
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
# shellcheck disable=SC1090
source ~/.nvm/nvm.sh
nvm install 16
nvm use 16
}

# Function to install global dependencies 📦🌍
install_dependencies() {
npm install -g mountebank
npm install -g [email protected]
npm audit fix
}

# Main function to execute setup steps 🚀
setup_project() {
install_nvm # Call the install_nvm function to install nvm and Node.js
install_dependencies # Call the install_dependencies function to install global dependencies
}

# Execute the setup 🎉
setup_project # Call the setup_project function to execute the setup steps

# Execute mb --configfile imposters.ejs ⚡️
mb --configfile imposters.ejs # Run the "mb --configfile imposters.ejs" command to execute Mountebank with the specified configuration file

# This script is written in Bash and aims to simplify the setup process for a project. Here's a breakdown of each section:

## 1. `install_nvm` function:
# - This function is responsible for installing nvm (Node Version Manager) and Node.js. 📦🌟
# - It uses the `curl` command to download the nvm installation script from the official GitHub repository.
# - The script is then executed using `bash` to install nvm.
# - After installation, the `~/.nvm/nvm.sh` file is sourced to make nvm available in the current shell session.
# - It installs Node.js version 16 using `nvm install 16` and sets it as the active version with `nvm use 16`.
#
## 2. `install_dependencies` function:
# - This function installs the global dependencies required for the project using `npm`. 📦🌍
# - The `npm install -g` command is used to install the following packages globally:
# - `mountebank`: A tool for creating mock servers and service virtualization.
# - `[email protected]`: The specified version of the npm package manager.
# - After the installation, `npm audit fix` is run to fix any reported vulnerabilities in the installed packages.
#
## 3. `setup_project` function:
# - This function serves as the main entry point for the setup steps. 🚀
# - It calls the `install_nvm` function to install nvm and Node.js.
# - Then it calls the `install_dependencies` function to install the global dependencies.
#
## 4. `setup_project` execution:
# - The `setup_project` function is executed, triggering the setup steps to be performed. 🎉
#
## 5. `mb --configfile imposters.ejs` execution:
# - After the setup is completed, the script runs the command `mb --configfile imposters.ejs`. ⚡️
# - This command executes Mountebank with the specified configuration file (`imposters.ejs`).
#
## This script provides a convenient way to set up the project environment by installing nvm, Node.js, global dependencies, and executing Mountebank with the desired configuration. Enjoy the setup process! 🎈🎊