← Back to list

autofix-java-import
by hyz0906
⭐ 0🍴 0📅 Jan 19, 2026
SKILL.md
name: autofix-java-import description: Fixes Java 'cannot find symbol' errors by adding import statements or library dependencies.
Java Import Skill
Fixes Java compilation errors related to missing classes or packages.
Detection Patterns
error: cannot find symbol+symbol: class Xerror: package X does not existerror: cannot access X
Strategy
- Extract Symbol: Get the missing class or package name.
- Find Package: Determine the full qualified name.
- Add Import: Insert import statement after package declaration.
- Add Dependency (if needed): Update build file with library.
Instructions
Step 1: Parse the Error
Extract class name or package from error message.
Step 2: Common Android/Java Mappings
| Class | Import | Library (Android.bp) |
|---|---|---|
RecyclerView | androidx.recyclerview.widget.RecyclerView | androidx.recyclerview_recyclerview |
LiveData | androidx.lifecycle.LiveData | androidx.lifecycle_lifecycle-livedata |
Gson | com.google.gson.Gson | gson |
Log | android.util.Log | (built-in) |
Bundle | android.os.Bundle | (built-in) |
Step 3: Add Import Statement
Insert after the package declaration:
package com.example.myapp;
import androidx.recyclerview.widget.RecyclerView; // ADD THIS
public class MainActivity {
Step 4: Add Dependency (if external library)
In Android.bp:
static_libs: [
"androidx.recyclerview_recyclerview",
],
In build.gradle:
implementation 'androidx.recyclerview:recyclerview:1.2.1'
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon