Yura Nalivayko
Yura Nalivayko

Reputation: 96

"error: cannot find symbol" when building Chromium for Android with new classes

I need to create a custom OmniboxResultsAdapter (org.chromium.chrome.browser.omnibox) for Chromium for Android. If I edit existing classes, everything is fine, but if I add new classes (for example, empty MyClass with no fields or methods) and try to use it in code (e.g., MyClass myObject = new MyClass()) and try to make a build with:

 chromium/src$ ninja -C out/Release chrome_public_apk

I get:

    ../chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java:1430: error: cannot find symbol
            MyClass myObject = new MyClass();
            ^
      symbol:   class MyClass
      location: class LocationBarLayout

    ../chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java:1430: error: cannot find symbol
            MyClass myObject = new MyClass();
                                   ^
      symbol:   class MyClass
      location: class LocationBarLayout
    2 errors

    ninja: build stopped: subcommand failed.

I suppose the compiler cannot find the class because of ProGuard.

What files do I need to modify to get the right result?

Upvotes: 3

Views: 512

Answers (1)

G.U.N
G.U.N

Reputation: 95

The java class of Chromium is declared in file src/chrome/android/java_sources.gni. You need to add the file path of MyClasst to that file like this:

"java/src/org/chromium/chrome/browser/MyClass.java"

Upvotes: 2

Related Questions