googlecodelabs / odml-pathways

Apache License 2.0
47 stars 31 forks source link

Unresolved reference: tensorflow #9

Open fatoboist opened 2 years ago

fatoboist commented 2 years ago

Expected Behavior

Codelab1 starter project runs on emulated device and shows "recording" screen

Actual Behavior

Build fails, unresolved reference: tensorflow

Steps to Reproduce the Problem

  1. follow steps in codelab for get the sample code
  2. Build fails
  3. Comment out line 8 of MainActivity.kt and build runs on emulated device

Specifications

YihanDong0828 commented 1 year ago

Hi! I had the same problem. I fixed the problem and hoped my experience could help anyone. I have no knowledge of coding or Andriod Studio, so my explanation maybe not be logical and reasonable. But it finally worked.

Firstly, go to Gradle Scripts-build.gradle (Module: My_Sound_Classification.app) and find targetSdkVersion. Set the SdkVersion to 33. Before it was 30, but Google has a new kind of update plan, so you need to update it as well.

Then, find a phone with Andriod 10-12 system. Do not use a very new Andriod phone, it would not work unless you know how to add an android name = true (not working for me, since I couldn't understand.)

Finally, make your old phone into a developer version and open debugging section (literally open all the USB-related power). Sync the project and run the app. It should work now.

I hope this could help anyone confused with the early setup stage.