I used the official code example as a starting point to write my own library. On the first few lines :

 * Copyright (C) 2010 The Android Open Source Project
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *      http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.

/* This is a JNI example where we use native methods to play sounds
 * using OpenSL ES. See the corresponding Java source file located at:
 *   src/com/example/nativeaudio/NativeAudio/NativeAudio.java

But of course being an example code, the code I have now does not look like it except some initialization routines, which all code that is going to use this library should do anyways. One thing that can be trace back to the code example is that I left the variable names related to said initialization logic as is as it is already good.

So do I have to put attribution in this case of the fact that I am learning from an example code with license? How much modification to consider that the code to become my own?

If I have to, because it is an Apache license I have to state changes. I have to state that I changed everything except the initialization routine?

  • 2
    How much modification to consider that the code to become my own? See: Theseus' Paradox applied to code copyright
    – Brandin
    Jul 5 '18 at 13:34
  • 2
    The fact that you learned from an example is not the relevant part. Only whether you copied the original example or whether your version is a derivative work of the original. Based on your description, I would guess that it is not a derivative work, but probably someone impartial would need to look at your code. If the "initialization logic" that you copied is one of only a few ways to initialize things, or if you copied only the 'logic' (the algorithmic steps required), then that is almost certainly not a copyright violation, but if in doubt, complying with the license is probably safer.
    – Brandin
    Jul 5 '18 at 13:37
  • 1
    "Because it is an Apache license I have to state changes..." - To answer this part see File with Apache 2.0 and my modifications
    – Brandin
    Jul 5 '18 at 13:41
  • It should come down to copyright ownership. If devA releases classA and then devB adds classB, then both devs need to agree to licencing changes. If devB then removes classA and replaces it with classC then devA has no copyrighted material in the project leaving devB as the only copyright owner of the code in the project. That would allow devB to change licensing terms without approval of devA.
    – sambler
    Jul 8 '18 at 3:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.