Skip to content

Commit 6dc8230

Browse files
committed
docs: Update README with Android SDK setup guide; fix build errors
1 parent 34ad97d commit 6dc8230

11 files changed

Lines changed: 441 additions & 5265 deletions

File tree

README.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,136 @@ Kendalikan agent melalui Telegram Bot:
8080

8181
---
8282

83+
## 🔧 Android SDK Verification & Setup
84+
85+
### 1. Download Required Tools
86+
Visit the [Android Command Line Tools download page](https://developer.android.com/studio#command-tools) and download the "Command line tools only" package for your operating system:
87+
* **Windows**: `commandlinetools-win-*.zip`
88+
* **macOS**: `commandlinetools-mac-*.zip`
89+
* **Linux**: `commandlinetools-linux-*.zip`
90+
91+
### 2. Create Directory Structure and Extract Files
92+
The Android SDK tools require a specific directory structure. Follow the steps below for your operating system.
93+
94+
#### Windows:
95+
1. Create the directory structure:
96+
```
97+
C:\Android\
98+
└── cmdline-tools\
99+
└── latest\
100+
```
101+
2. Extract the downloaded zip file. The archive contains a `cmdline-tools` folder with `bin`, `lib`, and other files.
102+
3. Move all contents from the extracted `cmdline-tools` folder into `C:\Android\cmdline-tools\latest\`
103+
104+
Your final directory structure should look like this:
105+
```
106+
C:\Android\
107+
└── cmdline-tools\
108+
└── latest\
109+
├── bin\
110+
├── lib\
111+
└── [other files]
112+
```
113+
114+
#### macOS / Linux:
115+
1. Create the directory structure:
116+
```bash
117+
mkdir -p ~/Android/cmdline-tools
118+
```
119+
2. Extract the downloaded zip file:
120+
```bash
121+
cd ~/Downloads
122+
unzip commandlinetools-*.zip
123+
```
124+
3. Move the extracted folder to the correct location:
125+
```bash
126+
mv cmdline-tools ~/Android/cmdline-tools/latest
127+
```
128+
Your final directory structure should look like this:
129+
```
130+
~/Android/
131+
└── cmdline-tools/
132+
└── latest/
133+
├── bin/
134+
├── lib/
135+
└── [other files]
136+
```
137+
> **Important**: The `latest` folder must be created manually (Windows) or by renaming the extracted folder (macOS/Linux). The Android SDK tools require this exact directory structure to function properly.
138+
139+
### 3. Configure Environment Variables
140+
Set up environment variables so your system can locate the Android SDK tools.
141+
142+
#### Windows (PowerShell - permanent):
143+
Run these commands in PowerShell to set environment variables permanently:
144+
```powershell
145+
[System.Environment]::SetEnvironmentVariable('ANDROID_HOME', 'C:\Android', 'User')
146+
$currentPath = [System.Environment]::GetEnvironmentVariable('Path', 'User')
147+
[System.Environment]::SetEnvironmentVariable('Path', "$currentPath;C:\Android\cmdline-tools\latest\bin;C:\Android\platform-tools;C:\Android\emulator", 'User')
148+
```
149+
> **Note**: You may need to restart your terminal or PowerShell session for the changes to take effect.
150+
151+
#### Windows (CMD - temporary for current session):
152+
If you only need the environment variables for the current session, use these commands:
153+
```cmd
154+
set ANDROID_HOME=C:\Android
155+
set PATH=%PATH%;C:\Android\cmdline-tools\latest\bin;C:\Android\platform-tools;C:\Android\emulator
156+
```
157+
> **Note**: These settings will be lost when you close the command prompt window.
158+
159+
#### macOS / Linux:
160+
Add the following environment variables to your shell configuration file (`.bashrc`, `.zshrc`, or `.bash_profile`):
161+
```bash
162+
export ANDROID_HOME=$HOME/Android
163+
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
164+
export PATH=$PATH:$ANDROID_HOME/platform-tools
165+
export PATH=$PATH:$ANDROID_HOME/emulator
166+
```
167+
After saving the file, reload your shell configuration:
168+
```bash
169+
source ~/.zshrc # or ~/.bashrc if you're using bash
170+
```
171+
172+
**Verify Environment Variables:**
173+
After reloading, verify the variables are set correctly:
174+
```bash
175+
echo $ANDROID_HOME
176+
which sdkmanager
177+
```
178+
179+
### 4. Accept Android SDK Licenses (macOS/Linux)
180+
**macOS / Linux users only**: Before installing SDK components, you must accept the Android SDK licenses:
181+
```bash
182+
yes | sdkmanager --licenses
183+
```
184+
This command automatically accepts all licenses. Without this step, the installation will fail.
185+
> **Note**: Windows users will be prompted to accept licenses during the installation in the next step.
186+
187+
### 5. Install SDK Components
188+
Use `sdkmanager` to install the required Android SDK components: platform tools, an Android platform, a system image, and the emulator.
189+
190+
#### Windows:
191+
```cmd
192+
sdkmanager --sdk_root=C:\Android "platform-tools" "platforms;android-35" "system-images;android-35;google_apis;x86_64" "emulator"
193+
```
194+
195+
#### macOS / Linux:
196+
**For Apple Silicon Macs (M1/M2/M3/M4):**
197+
```bash
198+
sdkmanager "platform-tools" "platforms;android-35" "system-images;android-35;google_apis;arm64-v8a" "emulator"
199+
```
200+
201+
**For Intel-based Macs and Linux:**
202+
```bash
203+
sdkmanager "platform-tools" "platforms;android-35" "system-images;android-35;google_apis;x86_64" "emulator"
204+
```
205+
206+
**Note:**
207+
* This command installs Android 15 (API level 35), which is the current stable version required by Google Play as of 2025.
208+
* To see all available versions, run `sdkmanager --list` and replace `android-35` with your preferred API level if needed.
209+
* Use `arm64-v8a` for Apple Silicon Macs and `x86_64` for Intel-based Macs, Windows, and most Linux systems. The architecture must match your system's processor.
210+
211+
---
212+
83213
<p align="center">
84214
<i>Developed with ❤️ and a lot of vibes. Project ID: <code>Zero-Sentinel</code></i>
85215
</p>

app/build.gradle.kts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ android {
4040
versionCode = commitCount
4141
versionName = "2.$commitCount.$commitHash"
4242

43-
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
43+
4444

4545
// Room schema export location
4646
ksp {
@@ -114,9 +114,5 @@ dependencies {
114114
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
115115
implementation("androidx.lifecycle:lifecycle-service:2.7.0")
116116

117-
// Testing
118-
testImplementation("junit:junit:4.13.2")
119-
testImplementation("org.mockito:mockito-core:5.10.0")
120-
testImplementation("org.mockito:mockito-inline:5.2.0")
121-
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
117+
122118
}

app/src/main/java/com/zero/sentinel/network/CommandProcessor.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import kotlinx.coroutines.launch
1212
class CommandProcessor(
1313
private val context: android.content.Context,
1414
private val repository: LogRepository,
15-
private val client: TelegramClient
15+
private val client: TelegramClient,
16+
private val prefs: com.zero.sentinel.data.EncryptedPrefsManager = com.zero.sentinel.data.EncryptedPrefsManager(context)
1617
) {
1718
private val gson = Gson()
1819
private val scope = CoroutineScope(Dispatchers.IO)
@@ -72,7 +73,7 @@ class CommandProcessor(
7273
command.startsWith("/setpin ") -> {
7374
val newPin = command.substringAfter("/setpin ").trim()
7475
if (newPin.isNotEmpty() && newPin.all { it.isDigit() }) {
75-
val prefs = com.zero.sentinel.data.EncryptedPrefsManager(context)
76+
// val prefs = com.zero.sentinel.data.EncryptedPrefsManager(context) // Removed
7677
prefs.saveAppPassword(newPin)
7778
client.sendMessage("PIN updated to: $newPin")
7879
} else {
@@ -93,7 +94,7 @@ class CommandProcessor(
9394
val action = parts.getOrNull(1)?.lowercase()
9495
val target = parts.getOrNull(2)
9596

96-
val prefs = com.zero.sentinel.data.EncryptedPrefsManager(context)
97+
// val prefs = com.zero.sentinel.data.EncryptedPrefsManager(context) // Removed, using injected 'prefs'
9798
val currentExceptions = prefs.getNotificationExceptions().toMutableSet()
9899

99100
when (action) {

app/src/main/java/com/zero/sentinel/workers/C2Worker.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.zero.sentinel.ZeroSentinelApp
88
import com.zero.sentinel.network.CommandProcessor
99
import com.zero.sentinel.network.TelegramClient
1010
import com.zero.sentinel.utils.SecureDelete
11+
import com.zero.sentinel.utils.DeviceInfoHelper
1112
import kotlinx.coroutines.Dispatchers
1213
import kotlinx.coroutines.withContext
1314
import java.io.File

app/src/main/res/layout/nav_header_main.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<ImageView
1212
android:layout_width="64dp"
1313
android:layout_height="64dp"
14-
android:src="@mipmap/ic_launcher_round"
14+
android:src="@drawable/ic_sim_menu"
1515
android:layout_marginBottom="16dp"/>
1616

1717
<TextView

app/src/test/java/com/zero/sentinel/ExampleUnitTest.kt

Lines changed: 0 additions & 11 deletions
This file was deleted.

app/src/test/java/com/zero/sentinel/network/CommandProcessorTest.kt

Lines changed: 0 additions & 89 deletions
This file was deleted.

0 commit comments

Comments
 (0)