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

error: resource android:attr/IStar not found #487

Open
ffarall opened this issue Dec 23, 2021 · 13 comments
Open

error: resource android:attr/IStar not found #487

ffarall opened this issue Dec 23, 2021 · 13 comments

Comments

@ffarall
Copy link

ffarall commented Dec 23, 2021

  • Unity editor version: 2021.2.7f1
  • External Dependency Manager version: 1.2.168
  • Source you installed EDM4U: .unitypackage
    • Features in External Dependency Manager in use: Android Resolver
  • Plugins SDK in use: Only my custom Kotlin plugin
  • Platform you are using the Unity editor on: Mac (M1 Pro)

[REQUIRED] Please describe the issue here:

I'm developing an Android Bluetooth plugin for Unity using Kotlin. I included the .aar file of my Kotlin library (which works perfectly in an app running in Android Studio), and since I was getting some dependency errors in runtime, I started using the Android Dependency Resolver plugin.

I started by adding the dependencies that my library had on its .gradle file:

dependencies {
    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.0'
    implementation 'com.google.android.material:material:1.4.0'

    // For Kotlin Coroutines
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2'
    
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

To my library's *Dependencies.xml, as instructed here by the Dependency Resolver:

<dependencies>
  <androidPackages>
    <repositories>
      <repository>https://repo.maven.apache.org/maven2</repository>
    </repositories>

    <androidPackage spec="androidx.appcompat:appcompat:1.4.0">
      <androidSdkPackageIds>
        <androidSdkPackageId>extra-google-m2repository</androidSdkPackageId>
      </androidSdkPackageIds>
      <repositories>
        <repository>https://maven.google.com</repository>
      </repositories>
    </androidPackage>

    <androidPackage spec="androidx.core:core-ktx:1.7.0">
      <androidSdkPackageIds>
        <androidSdkPackageId>extra-google-m2repository</androidSdkPackageId>
      </androidSdkPackageIds>
      <repositories>
        <repository>https://maven.google.com</repository>
      </repositories>
    </androidPackage>

    <androidPackage spec="org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2">
      <androidSdkPackageIds>
        <androidSdkPackageId>extra-google-m2repository</androidSdkPackageId>
      </androidSdkPackageIds>
      <repositories>
        <repository>https://maven.google.com</repository>
      </repositories>
    </androidPackage>

  </androidPackages>
</dependencies>

The Dependency Resolver works and does it's job, but then when I try to compile the project I get the error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:processReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     /Users/myuser/.gradle/caches/transforms-2/files-2.1/f243f87f287fb4f4052bd069a9b71980/androidx.core.core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.

I provide the .aar if you need it to reproduce the error.

Please answer the following, if applicable:

What's the issue repro rate? 100%

What happened? How can we make the problem occur?
Add my custom library's .aar and its *Dependencies.xml file and run de Resolver, then compile.

gravrblelibrary-debug.aar.zip

@ffarall ffarall added new to be triaged type: question labels Dec 23, 2021
@google-oss-bot
Copy link

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@paulinon paulinon removed the new to be triaged label Dec 23, 2021
@paulinon
Copy link
Collaborator

Hi @ffarall,

Thanks for reporting this. Could you provide the .aar file you used so that we can identify what's causing this behavior?

@paulinon paulinon added the needs-info Need information for the developer label Dec 23, 2021
@ffarall
Copy link
Author

ffarall commented Dec 23, 2021

Hello @paulinon, thanks for the quick reply. I've uploaded the .aar in a .zip file, in the first comment of the issue. Is it not accessible? I can try another way to upload it if that's the case.

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Dec 23, 2021
@paulinon
Copy link
Collaborator

Thanks for that, @ffarall. I haven't been able to reproduce the error message you encountered so far. Could you provide a minimal, reproducible example of your implementation? This can be used to troubleshoot the issue.

@paulinon paulinon added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels Dec 23, 2021
@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Dec 23, 2021
@ffarall
Copy link
Author

ffarall commented Dec 23, 2021

In this repository you'll find the folders Android and Unity. Android is the Android Studio project where the library was developed, and where it's working as it's supposed to. Inside Unity, the POC-00v1 folder contains the Unity project that consists of a basic scene and the script of the plugin we're developing. It uses the Dependency Resolver as well as the Oculus plugin, and it's where the issue arises.

@ffarall
Copy link
Author

ffarall commented Dec 23, 2021

In this stackoverflow question that I published, someone suggested that it might be related to the compileSdkVersion being lower than 31, and that I should use older versions of androix. If that should be the case, how would I force the resolver to use older versions in ALL of the .arr it's adding? As they are a lot more than those which I defined in *Dependencies.xml

@ffarall
Copy link
Author

ffarall commented Dec 24, 2021

I found a workaround. The androidx.core.core-1.7.0 dependency was causing the problem of the IStar not found, so I manually downloaded the previous version (androidx.core.core-1.6.0) from here and placed it in Assets > Plugins > Android. Then I run the Dependency Resolver (which added androidx.core.core-1.7.0), and manually deleted androidx.core.core-1.7.0. The app compiled and run as it was supposed to. I have to say, however, that I did try to specify that I wanted to use androidx.core.core-1.6.0 in the *Dependencies.xml file, but the resolver still adds androidx.core.core-1.7.0.

@paulinon
Copy link
Collaborator

Thanks for the information, @ffarall. I was able to replicate your issue using the sample project you provided. I'll be marking this as a bug for now so that I can relay this to the team, and we'll let you know once we have updates.

@paulinon paulinon added type: bug and removed type: question needs-attention Need Googler's attention labels Dec 27, 2021
@chkuang-g
Copy link
Collaborator

Hi @ffarall

Sorry this has been for awhile.

Here are some recommendation:

  • When you specify androidx.core.core in Dependencies.xml, use something like
    androidx.core.core:[1.6.0]
    
    This is how you specify an exact version for a package. The resolution may fail because some other package may have hard dependency on other versions.
  • It is unclear that if you are using mainTemplate.gradle or not. If not, I recommend you to enable Custom Main Gradle Template in Player Setting, which will generate Assets/Android/Plugin/mainTemplate.grade. In that case, EDM4U just injecting the deps from Dependencies.xml to mainTemplate.gralde and let Unity to resolve it with gradle. This is usually better solution for later version of Unity.

Hope this helps. If this is still a problem, please let us know more about your setup or a minimum viable project.

Thank you

@ffarall
Copy link
Author

ffarall commented May 1, 2022

Hello @chkuang-g,

Thanks for the reply. Unfortunately none of the options you gave me worked out, and the Resolver still installs androidx.core.core-1.7.0. In this message I provided a minimum viable repo in which @paulinon was able to replicate the issue. Tell me if that doesn't work for you

@chkuang-g chkuang-g reopened this May 12, 2022
@p0w1nd
Copy link

p0w1nd commented May 15, 2022

I've just encountered this error when building for Android.
Unity editor version: 2021.2.7f1
External Dependency Manager version: 1.2.170

In Player Settings -> Target API Level, I changed it from Automatic (highest installed) to API Level 32 explicitly, then it works.

Screen Shot 2022-05-15 at 10 43 24

@zenith-jacob
Copy link

Still no workaround.

I found out that in my case it was caused by the Facebook Audience Network adapter's update in Applovin's Unity SDK.
Even when I downgraded Applovin from 11.4 to 10.3, and downgraded FAN's adapter in Dependencies.xml to the one that worked previously - it still somehow pulls Applovin 11.4 despite the fact that I downgraded Applovin and in it's dependencies it shows 10.3.

Here's Dependencies.xml from Applovin's FB adapter for which it worked previously (2 days ago). Applovin released an update and since then, android:core is pulled as 1.7, not 1.6 (or 1.3.2 or whatever)

<?xml version="1.0" encoding="utf-8"?>
<dependencies>
    <androidPackages>
        <!-- Ensure that Resolver doesn't inadvertently pull Facebook's beta versions of the SDK by forcing a specific version.
             Since FAN SDK depends on older versions of a few support and play service versions
             `com.applovin.mediation:facebook-adapter:x.y.z.a` resolves to `com.applovin.mediation:facebook-adapter:+` which pulls down the beta versions of FAN SDK.
             Note that forcing the adapter is enough to stop Jar Resolver from pulling the latest FAN SDK. -->
        <androidPackage spec="com.applovin.mediation:facebook-adapter:[6.10.0.1]" />
    </androidPackages>
    <iosPods>
        <iosPod name="AppLovinMediationFacebookAdapter" version="6.10.0.2" />
    </iosPods>
</dependencies>

@ersagunkuruca
Copy link

I've been trying to deal with this for a few weeks now, I thought it was all because of the AppLovin plugin, now that I fixed a build by downgrading External Dependency Manager, I am not so sure anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants